Message 1 of 4
planarFace in ReferenceLine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I try to create a ConnectorElement on ReferenceLine(like in Connector.png) but I still have null as reference, here is part of my test code:
private void again(ref ModelCurve mcurve, View view) { using (SubTransaction subT = new SubTransaction(_Family)) { subT.Start(); _Family.Regenerate(); Options opt = new Options(); opt.ComputeReferences = true; opt.IncludeNonVisibleObjects = true; opt.View = view; opt.ComputeReferences = true; GeometryElement ge = mcurve.get_Geometry(opt); foreach (Solid solid in ge) { foreach (PlanarFace item in solid.Faces) { if (item.FaceNormal.IsAlmostEqualTo(XYZ.BasisX) || item.FaceNormal.IsAlmostEqualTo(-XYZ.BasisX)) { //why is null ConnectorElement.CreatePipeConnector(_Family, PipeSystemType.Global, item.Reference); } } } subT.Commit(); } }
but PlanarFace reference is still null, how can I get Reference for PlanarFace?
I look at:
https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-reference-of-a-planarface/td-p/6489839
http://www.revitapidocs.com/2016/6fdcd1e4-61d0-2a01-2e5b-b5d918f0cfee.htm
for some reason all this method don't what to work with ReferenceLine.
I made a referenceLine with
SketchPlane sketchPlane = SketchPlane.Create(_Family, view.GenLevel.Id); Curve curve = Line.CreateBound(new XYZ(-2, 0, 0), new XYZ(2, 0, 0)); using (SubTransaction subT = new SubTransaction(_Family)) { subT.Start(); mLine = _Family.FamilyCreate.NewModelCurve(curve, sketchPlane); mLine.ChangeToReferenceLine(); subT.Commit(); } _Family.Regenerate();
I work on Revit 2017
-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug