当前位置:网站首页>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);
边栏推荐
- OpenGL job coordinate system
- Kaggle-Titanic
- Ueeditor custom display insert code
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
- 为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
- Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
- 双塔模型的最强出装,谷歌又开始玩起“老古董”了?
- OpenGL configure assimp
- Remember an experience of using selectmany
- Reptile combat (VII): pictures of the king of reptiles' heroes
猜你喜欢
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
Ueeditor custom display insert code
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Firefox browser installation impression notes clipping
PDF文档签名指南
如何实现横版游戏中角色的移动控制
The function is really powerful!
[advanced MySQL] index details (I): index data page structure
Jerry's about TWS pairing mode configuration [chapter]
双塔模型的最强出装,谷歌又开始玩起“老古董”了?
随机推荐
[open source] Net ORM accessing Firebird database
What is the difference between the three values of null Nan undefined in JS
OpenGL job coordinate system
Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
反爬通杀神器
Programming mode - table driven programming
Tsconfig of typescript TS basics JSON configuration options
100million single men and women "online dating", supporting 13billion IPOs
Kaggle-Titanic
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
UWA问答精选
Google SEO external chain backlinks research tool recommendation
Use partial derivatives to display normals in unity
Solve the problem of uni in uni app Request sent a post request without response.
null == undefined
QT compile IOT management platform 39 alarm linkage
Talk about relational database and serverless
Jerry's test box configuration channel [chapter]
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
operator