当前位置:网站首页>Revit secondary development - cut view
Revit secondary development - cut view
2022-07-07 22:22:00 【Hey, hey, hey, hey, hey】
demand : Draw the section line manually , After drawing, switch to the section view just drawn .
( Provincial users then click to go to the view , Only the first automatic jump , If you adjust the sectioning box, it will no longer jump automatically )ps: There are really all kinds of needs , I'm basically speechless. .
be used DocumentChange Events and external events .
1、 stay DocumentChange Event to listen whether to create a finished cut plane ,
2、 Record the view after creation ID Use external events to convert to the section view just created .
External events
public class ViewHandler : IExternalEventHandler
{
public void Execute(UIApplication app)
{
if(Command.gbv_viewSectionid == null) return;
Document doc = app.ActiveUIDocument.Document;
ViewSection vs = doc.GetElement(Command.gbv_viewSectionid) as ViewSection;
app.ActiveUIDocument.ActiveView = vs;
}
public string GetName()
{
return "view";
}
}
command
class Command
{
public static ElementId gbv_viewSectionId=null;
private ExternalEvent viewEvevt=null;
private bool m_IsCreatedSection = false;
public Result Execute(ExternalCommandData command)
{
UIDocument uiDoc = command.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
View view = doc.ActiveView;
if(view == ViewTye.ThreeD)return Result.Cancelled;
ViewHandler handler = new ViewHandler();
viewEvent = ExternalEvent.Create(handler);
RevitCommandId commandId = RevitCommandId.LookupPostableCommandId(PostableCommand.Section);
command.Application.PostCommand(commandId);
command.Application.Application.DocumentChange+=Application_DocumentChange;
m_IsCreatedSection=true;
}
privte void Application_DocumentChange(object sender, DocumentChangeEventArgs e)
{
if(IsCreatedSection)
{
IsCreatedSection = false;
Document doc = e.GetDocument();
list<ElementId> lstEid = e.GetAddElementIds().ToList();
foreach(ElementId eid in lstEid)
{
ViewSection vs = doc.GetElement(eid) as ViewSection;
if(vs != null)
{
gbv_viewSectionid = eid;
if(viewEvent != null)
viewEvent.Raise();
break;
}
}
}
}
}
边栏推荐
- Google SEO external chain backlinks research tool recommendation
- Open source OA development platform: contract management user manual
- Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
- Two kinds of updates lost and Solutions
- 用语雀写文章了,功能真心强大!
- ByteDance senior engineer interview, easy to get started, fluent
- Tsconfig of typescript TS basics JSON configuration options
- [open source] Net ORM accessing Firebird database
- How to turn on win11 game mode? How to turn on game mode in win11
- [开源] .Net ORM 访问 Firebird 数据库
猜你喜欢
Vs custom template - take the custom class template as an example
100million single men and women "online dating", supporting 13billion IPOs
. Net automapper use
Debugging and handling the problem of jamming for about 30s during SSH login
TCP/IP 协议栈
Antd date component appears in English
如何实现横版游戏中角色的移动控制
Win11游戏模式怎么开启?Win11开启游戏模式的方法
The whole network "chases" Zhong Xuegao
Two methods of calling WCF service by C #
随机推荐
Use blocconsumer to build responsive components and monitor status at the same time
为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
Use partial derivatives to display normals in unity
OpenGL job coordinate system
[开源] .Net ORM 访问 Firebird 数据库
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
PKPM 2020软件安装包下载及安装教程
L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
The strongest installation of the twin tower model, Google is playing "antique" again?
Jerry's key to initiate pairing [chapter]
Build your own website (18)
Jerry's about TWS channel configuration [chapter]
Node:504 error reporting
The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
Px4 autonomous flight
Matplotlib drawing interface settings
Dbsync adds support for mongodb and ES
Ad domain group policy management
Remember that a development is encountered in the pit of origin string sorting
嵌入式开发:如何为项目选择合适的RTOS?