Message 1 of 6
New Dimension are not Visible
Not applicable
07-09-2018
02:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everybody,
I'm actually trying to create a new dimension for a Rebar element.
To sum up I try to do something like the MultiAnnotation Command but without the Tag.
After further research, I found a way to catch the reference of each Rebar of the Rebar Distribution and to put a dimension on it, but the Problem is the following :
The function Create.Newdimension (on the last line of my code) returns me a dimension but at the end of the execution, I can't see this dimension.
Options opt = app.Create.NewGeometryOptions();
opt.ComputeReferences = true;
opt.IncludeNonVisibleObjects = false;
opt.View = doc.ActiveView;
ReferenceArray referenceArray = new ReferenceArray();
List<XYZ> ListPoint = new List<XYZ>();
GeometryElement geometryElement = rebar.get_Geometry(opt);
foreach (GeometryObject obj in geometryElement)
{
if (obj is Solid)
{
Solid solid = obj as Solid;
FaceArray faceArray = solid.Faces;
// Search the biggest Face Area
Face BiggestFace = faceArray.get_Item(0);
foreach (Face face in faceArray)
{
if (face.Area > BiggestFace.Area)
{
BiggestFace = face;
}
}
Face fa = BiggestFace;
{
if (fa != null)
{
PlanarFace planarFace = fa as PlanarFace;
XYZ point = planarFace.Origin;
Reference refer = planarFace.Reference;
if (refer != null && referenceArray.Size < 3) //I only need the 2 first Rebar Faces of the Rebar distribution
{
referenceArray.Append(refer);
ListPoint.Add(point);
}
}
}
}
}
using (Transaction t = new Transaction(doc, "Creation Ligne de cote"))
{
t.Start();
Line line1 = Line.CreateBound(ListPoint[0], ListPoint[1]);
Dimension newDimension = doc.Create.NewDimension(doc.ActiveView, line1, referenceArray);
t.Commit();
}
Does somebody have an Idea why the new Dimensions are not visible?
I already tried many modifications on the code, but I can't find if the Origin of the problem comes from the ReferenceArray or from the dimension ...
Thanks in Advance,