当前位置:网站首页>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);
边栏推荐
- How to turn on win11 game mode? How to turn on game mode in win11
- How to choose the appropriate automated testing tools?
- The essence of analog Servlet
- JS number is insufficient, and 0 is added
- Time standard library
- Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
- Jerry's fast pairing does not support canceling pairing [article]
- Debugging and handling the problem of jamming for about 30s during SSH login
- #DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
- operator
猜你喜欢
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
Anti climbing killer
Latest Android advanced interview questions summary, Android interview questions and answers
NVR hard disk video recorder is connected to easycvr through the national standard gb28181 protocol. What is the reason why the device channel information is not displayed?
如何实现横版游戏中角色的移动控制
Implementation method of data platform landing
Node:504 error reporting
#DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
Index summary (assault version)
随机推荐
Xcode modifies the default background image of launchscreen and still displays the original image
#DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
ByteDance Android interview, summary of knowledge points + analysis of interview questions
How polardb-x does distributed database hotspot analysis
Vs custom template - take the custom class template as an example
The function is really powerful!
OpeGL personal notes - lights
How does win11 unblock the keyboard? Method of unlocking keyboard in win11
[interview arrangement] 0211 game engine server
The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
EasyCVR配置中心录像计划页面调整分辨率时的显示优化
Matplotlib快速入门
SAR image quality evaluation
What is the difference between the three values of null Nan undefined in JS
Jerry's test box configuration channel [chapter]
Can I open a stock account directly online now? Is it safe?
Anti climbing killer
QT compile IOT management platform 39 alarm linkage
An in-depth understanding of fp/fn/precision/recall