当前位置:网站首页>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);
边栏推荐
- Ternary expressions, generative expressions, anonymous functions
- OpenGL job coordinate system
- 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?
- 强化学习-学习笔记9 | Multi-Step-TD-Target
- How does win11 unblock the keyboard? Method of unlocking keyboard in win11
- Win11时间怎么显示星期几?Win11怎么显示今天周几?
- 648. Word replacement
- Typeorm automatically generates entity classes
- Xcode modifies the default background image of launchscreen and still displays the original image
- [azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
猜你喜欢
Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
QT compile IOT management platform 39 alarm linkage
. Net automapper use
Vs custom template - take the custom class template as an example
谈谈制造企业如何制定敏捷的数字化转型策略
Embedded development: how to choose the right RTOS for the project?
Build your own website (18)
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
Jerry's manual matching method [chapter]
随机推荐
Song list 11111
Firefox browser installation impression notes clipping
如何选择合适的自动化测试工具?
Google SEO external chain backlinks research tool recommendation
The essence of analog Servlet
如何实现横版游戏中角色的移动控制
Typescript TS basic knowledge type declaration
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
Use blocconsumer to build responsive components and monitor status at the same time
Remember that a development is encountered in the pit of origin string sorting
The free styling service of Dyson's official direct store is now open for appointment. Pioneer Technology interprets the styling concept of hair care and helps consumers unlock diversified and shiny s
How to close eslint related rules
强化学习-学习笔记9 | Multi-Step-TD-Target
Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?
Write in front -- Talking about program development
OpenGL configure assimp
MIT6.S081-Lab9 FS [2021Fall]
Oracle advanced (VI) Oracle expdp/impdp details
Jerry's configuration of TWS cross pairing [article]