惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
Simon Willison's Weblog
Simon Willison's Weblog
H
Help Net Security
F
Fortinet All Blogs
H
Heimdal Security Blog
S
Schneier on Security
L
LangChain Blog
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
NISL@THU
NISL@THU
P
Palo Alto Networks Blog
J
Java Code Geeks
博客园 - 【当耐特】
The Last Watchdog
The Last Watchdog
W
WeLiveSecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost
I
InfoQ
Recorded Future
Recorded Future
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CERT Recently Published Vulnerability Notes
T
Tenable Blog
腾讯CDC
C
Check Point Blog
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
罗磊的独立博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog
小众软件
小众软件
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
V2EX - 技术
V2EX - 技术
T
Threatpost
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
T
Tailwind CSS Blog
S
Securelist
The Cloudflare Blog
博客园 - 叶小钗
L
LINUX DO - 最新话题
T
Troy Hunt's Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
爱范儿
爱范儿

博客园 - jdmei520

2D纹理与3D模型共存时的渲染问题 Adventure Works示例数据库介绍 基于 SOA 的监测、诊断与预测系统架构 基于SOA的设备智能维护系统架构设计及实现 WCF基础知识问与答 (转载) 学习资源 Wcf概述 用Visual C#创建Windows服务程序 VS2005没有源代码管理选项和菜单 - jdmei520 - 博客园 RFID射频识别技术 微软RFID开发平台BizTalk资料收集 未能建立与LOCAL的连接——Telnet成功,这就说明是你自己造成的 TextBox 绑定表的数字类型字段,清除文本框内容时,焦点不能移出文本框的解决方法 - jdmei520 - 博客园 使用NUnit在.Net编程中进行单元测试 Enterprise Library 企业库 ListView控件(在ListView失去焦点的情况下仍然保持Item高亮) 控制图纸多线相交交点凸起(Control PolyLine Bulge open and close ) 常用数据库访问接口 广州日报新媒体发展战略解析(转)
如何编程控制动态块的参数、动作
jdmei520 · 2009-11-24 · via 博客园 - jdmei520

见到论坛上有过不少动态块动作控制的问题。呵呵。其实使用objectarx.net是可以操作动态块参数、动作的。嘿嘿。
先看看我的效果图,两个简单例子:【1.开关的可见性参数;2.开关的跨度距离参数(对应有拉伸动作)】 

 怎么实现,很简单。
直接修改动态块的属性值即可。 


  [CommandMethod(
"SetDynamicValue")]
        
public void SetDynamicValue()
        
{
            Editor ed 
= AsApp.DocumentManager.MdiActiveDocument.Editor;
            
try
            
{
                ObjectId blrid 
= ObjectId.Null;
                PromptEntityOptions peo 
= new PromptEntityOptions("选择动态块");
                PromptEntityResult per 
= ed.GetEntity(peo);
                
if (per.Status == PromptStatus.OK)
                
{
                    blrid 
= per.ObjectId;
                }

                
else return;
                Database db 
= HostApplicationServices.WorkingDatabase;
                
using (Transaction tra = db.TransactionManager.StartTransaction())
                
{
                    Entity ent 
= (Entity)tra.GetObject(blrid, OpenMode.ForWrite);
                    
if (ent is BlockReference)
                    
{
                        BlockReference blr 
= ent as BlockReference;
                        
if (blr.IsDynamicBlock)
                        
{
                            
foreach (DynamicBlockReferenceProperty dbrp in blr.DynamicBlockReferencePropertyCollection)
                            
{
                                
if (dbrp.PropertyName == "可见性")
                                
{
                                    
if (dbrp.Value.ToString() == "断开")
                                        dbrp.Value 
= "闭合";
                                    
else
                                        dbrp.Value 
= "断开";
                                }

                                
if (dbrp.PropertyName == "距离")
                                
{
                                    dbrp.Value 
= Convert.ToDouble(dbrp.Value.ToString()) + 5;
                                }

                            }

                        }

                    }

                    tra.Commit();
                }

            }

            
catch (System.Exception exc)
            
{
                ed.WriteMessage(
"Error:" + exc.Message + exc.StackTrace);
            }

        }