当前位置:网站首页>Revit secondary development - Hide occlusion elements
Revit secondary development - Hide occlusion elements
2022-07-07 22:22:00 【Hey, hey, hey, hey, hey】
background : After the conflict detection is completed, you need to display the elements that collide with each other and take screenshots , Because there will be a house 、 Ground and other large models , Therefore, we often encounter elements that are blocked .
Solutions :
1、 Will project's “ Visual style ” Change it to “ Hidden line ” Pattern ( When the screenshot is selected, it will be more clearly displayed )、 Set the view direction to top ( From the top down ).
2、 Create a model line to detect which occlusion elements , And hide the element .
3、 After the screenshot, show the hidden elements .
// Set the visual style of the project
uiDoc.ActiveView.get_Parameter(BuiltInParameter.MODEL_GRAPHICS).Set(2);
// Set the view to top
View3D view = uiDoc.ActiveView as View3D;
view.OrientTo(-XYZ.BasisZ);
// Create a model line according to the midpoint of the element , Filter out occluding elements
XYZ ptStart = null;
if(element.Location is LocationPoint)
{
LocationPoint lp = element.Location as LocationPoint;
ptStart = lp.Point;
}
else if(element.Location is LocationCurve)
{
LocationCurve lc = element.Location as LocationCurve;
ptStart = (lc.Curve.GetEndPoint(0) + lc.Curve.GetEndPoint(1)) / 2;
}
else
{
BoundingBoxXYZ box = element.get_BoundingBox(doc.ActiveView);
ptStart = (box.Min + box.Max) / 2;
}
XYZ ptEnd = new XYZ(ptStart.X,ptStart.Y,ptStart.Z + 100);
ModelCurve mc = DrawModelCurve(doc,Line.CreateBound(ptStart,ptEnd));
BoundingBoxXYZ mcBox = mc.get_BoundingBoxXYZ(doc.ActiveView);
Outline ol = new Outline(mcBox.Min,mcBox.Max);
BoundingBoxIntersectsFilter boxFilter = new BoundingBoxIntersectsFilter(ol);
FilteredElementCollector fec = new FilteredElementCollector(doc);
List<ElementId> ids = fec.WherePasses(boxFilter).ToElementIds().ToList();
// Set the occlusion element to hide
uiDoc.ActiveView.HideElements(ids);
// Screenshot
ImageExportOptions ieo = new ImageExportOptions();
ieo.ZoomType = ZoomType.FitToPage;
iep.ExportRange = ExportRange.VisibleRegionOfCurrentView;
ieo.FilePath = @"d:\";
ieo.GLRandWFViewsFileType = ImageFileType.JPEGMedium;
ieo.ShadowViewsFileType = ImageFileType.JPEGMedium;
doc.ExportImage(ieo);
// Show occluded elements
uiDoc.ActiveView.UnhideElements(ids);
边栏推荐
- Have you ever been confused? Once a test / development programmer, ignorant gadget C bird upgrade
- 变量与常量
- Matplotlib快速入门
- Remember aximp once Use of exe tool
- Anti climbing killer
- Ternary expressions, generative expressions, anonymous functions
- TCP/IP 协议栈
- 如何选择合适的自动化测试工具?
- Firefox browser installation impression notes clipping
- Get the week start time and week end time of the current date
猜你喜欢
Two kinds of updates lost and Solutions
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
How to make agile digital transformation strategy for manufacturing enterprises
Implementation method of data platform landing
[azure microservice service fabric] start the performance monitor in the SF node and set the method of capturing the process
Firefox browser installation impression notes clipping
Matplotlib drawing interface settings
使用 BlocConsumer 同时构建响应式组件和监听状态
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
QT compile IOT management platform 39 alarm linkage
随机推荐
戴森官方直营店免费造型服务现已开放预约 先锋科技诠释护发造型理念,助力消费者解锁多元闪耀造型
三元表达式、各生成式、匿名函数
Win11时间怎么显示星期几?Win11怎么显示今天周几?
JS number is insufficient, and 0 is added
强化学习-学习笔记9 | Multi-Step-TD-Target
[开源] .Net ORM 访问 Firebird 数据库
怎样写一个增广矩阵到txt文件中
. Net automapper use
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
Use blocconsumer to build responsive components and monitor status at the same time
为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
嵌入式开发:如何为项目选择合适的RTOS?
Tcp/ip protocol stack
Write in front -- Talking about program development
Remove the default background color of chrome input input box
Cannot find module 'xxx' or its corresponding type declaration
OpenGL configuration vs2019
Implementation method of data platform landing
NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?