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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
V
Visual Studio Blog
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
Last Week in AI
Last Week in AI
C
Check Point Blog
D
Docker
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
博客园 - 叶小钗
博客园 - 聂微东
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
腾讯CDC
S
SegmentFault 最新的问题
博客园 - 【当耐特】

博客园 - 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);
            }

        }