
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been trying to get my head around how to get a familyInstance's referencePlane (Center Left/Right) Reference, to align and lock to a line on a view.
So far I have been able to align simple DetailCurve's to each other with the newAlignment() command, but I am having issues getting the Center (Left/Right) referencePlane's reference from inside a faimlyInstance using get_geometry().
I have been able to find the lines within the get_geometry but when I use the newAlignment() command it states there was an issue with the command, although the family and the line are on the same axis and ready for alignment locking.
Below is the code I have used:
double ftMM = 1 / 304.8; // Feet to Millimetres Options opt = new Options(); opt.ComputeReferences = true; opt.IncludeNonVisibleObjects = true; opt.View = doc.ActiveView; DetailCurve circuitLine = doc.Create.NewDetailCurve(draftView, Line.CreateBound(new XYZ(0, 0, 0) * ftMM, new XYZ(0, 50, 0) * ftMM)); // Basic Circuit Line DetailCurve circuitLine2 = doc.Create.NewDetailCurve(draftView, Line.CreateBound(new XYZ(0, 70, 0) * ftMM, new XYZ(0, 150, 0) * ftMM)); // Basic Circuit Line doc.Create.NewAlignment(draftView, circuitLine.GeometryCurve.Reference, circuitLine2.GeometryCurve.Reference); // This works fine. FamilyInstance deviceInstance = doc.Create.NewFamilyInstance(new XYZ(0, 9, 0) * ftMM, deviceFamily, draftView); // Device Type
What would be the best method to get the standard referencePlane = Center (Left/Right) from the familyInstance inserted in the code above?
I have used the following to get all the lines within the familyInstance:
GeometryInstance geoElement = deviceInstance.get_Geometry(opt).First() as GeometryInstance; foreach (var item in geoElement.GetInstanceGeometry()) { Line lineObj = item as Line; if (lineObj != null) { TaskDialog.Show("Test Line", lineObj.Reference.ToString()); } }
I have tried using any of the lines within the above code and none seemed to work with the newAlignment() command.
Solved! Go to Solution.