当前位置:网站首页>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);
边栏推荐
- SAR image quality evaluation
- Preparing for the interview and sharing experience
- The latest Android interview collection, Android video extraction audio
- [azure microservice service fabric] start the performance monitor in the SF node and set the method of capturing the process
- 【colmap】稀疏重建转为MVSNet格式输入
- Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
- operator
- Dbsync adds support for mongodb and ES
- Welcome to CSDN markdown editor
- Crawler (17) - Interview (2) | crawler interview question bank
猜你喜欢
Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
Crawler (17) - Interview (2) | crawler interview question bank
Time standard library
Two methods of calling WCF service by C #
PKPM 2020 software installation package download and installation tutorial
ByteDance senior engineer interview, easy to get started, fluent
Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
Win11如何解禁键盘?Win11解禁键盘的方法
Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
PDF文档签名指南
随机推荐
嵌入式开发:如何为项目选择合适的RTOS?
Google SEO external chain backlinks research tool recommendation
[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
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
OpenGL jobs - shaders
PKPM 2020 software installation package download and installation tutorial
使用 CustomPaint 绘制基本图形
Ant destination multiple selection
operator
Add get disabled for RC form
Jerry's configuration of TWS cross pairing [article]
Main functions of OS, Sys and random Standard Libraries
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
海外代理推荐
Tcp/ip protocol stack
Write in front -- Talking about program development
[JDBC Part 1] overview, get connection, CRUD
客户案例|华律网,通过观测云大幅缩短故障定位时间
The essence of analog Servlet