Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

DimensionSegment /Dimension Segment Array

Anonymous

DimensionSegment /Dimension Segment Array

Anonymous
Not applicable

sample dim.PNG

 

I am familiar with the process to generate dimensions by creating lines and adding references to an array. However,  I have been attempting to recreate an ordinate dimension string as seen in the image, where it is a single string with multiple references. From using Revit Lookup, it appears I need to construct a DimensionSegmentArray and Append it with a DimensionSegment.  I've attempted to create lines and use those, but get an error to create "DimensionSegments" instead. I've searched hours for a solution to this, but I am apparently missing something.

 

How would I construct a "Dimension Segment"?

 

Would I have to create a NewDimension for each segment, then append those to create another, longer dimension? If that's the case, then how would the number of Reference Arrays work in the longer NewDimension?

0 Likes
Reply
Accepted solutions (1)
1,710 Views
3 Replies
Replies (3)

Anonymous
Not applicable
Accepted solution

Using the code below, I was able to generate a single dimension string. How would I be able to generate a dimension string with multiple references and dimension segments (as seen in the image below the code and in the first post)?

 

When I Append multiple references to the ReferenceArray, I get an error saying "Expected DimensionSegment, got Line" for the dimension transaction. I also generated an unboundline to see if that woul work. A solution to this would be a huge help. 

P1 = edge.AsCurve().GetEndPoint(0)
P2 = edge.AsCurve().GetEndPoint(1)
        
dimensionLine = Line.CreateBound(P1, P2)

dlEdRef1 = edge.GetEndPointReference(0)
dlEdRef2 = edge.GetEndPointReference(1)

edgeRefArray = ReferenceArray()
		
edgeRefArray.Append(dlEdRef1)
edgeRefArray.Append(dlEdRef2)

tt.Start()
dim = doc.Create.NewDimension (view, dimensionLine, edgeRefArray)
tt.Commit()

dimension segments.PNG

Anonymous
Not applicable

I answered my own question in the post above after a bit more exploration. 

0 Likes

dem1st
Enthusiast
Enthusiast

Segments got created automatically as reference planes were sequentially added one after another to the reference array.

 

XYZ p1 = new XYZ(10, 10, 0);
XYZ p2 = new XYZ(10, -10, 0);
XYZ p3 = new XYZ(-10, -10, 0);
XYZ p4 = new XYZ(-10, 10, 0);

ReferencePlane refplane1 = doc.FamilyCreate.NewReferencePlane(p4, p1, cutVec, uidoc.ActiveGraphicalView);
ReferencePlane refplane2 = doc.FamilyCreate.NewReferencePlane(p3, p2, cutVec, uidoc.ActiveGraphicalView);

ReferenceArray raD = new ReferenceArray();
ReferencePlane refplane3 = doc.FamilyCreate.NewReferencePlane(new XYZ(0, 0, 0), new XYZ(1, 0, 0), cutVec, uidoc.ActiveGraphicalView);
doc.Regenerate();

            raD1.Append(refplane2.GetReference());
            raD1.Append(refplane3.GetReference());
            raD1.Append(refplane1.GetReference());

            Line LineD = Line.CreateBound(new XYZ(p4.X-0.5, p4.Y , p4.Z), new XYZ(p3.X-0.5, p3.Y , p3.Z));

            var dimD = doc.FamilyCreate.NewLinearDimension(uidoc.ActiveGraphicalView, LineD, raD1);

            DimensionSegmentArray s = dimD.Segments;
            s.get_Item(0).IsLocked = true;
            s.get_Item(1).IsLocked = true;
            dimD.AreSegmentsEqual = true;

 

0 Likes