problem: Dimension for column

problem: Dimension for column

Anonymous
Not applicable
2,914 Views
8 Replies
Message 1 of 9

problem: Dimension for column

Anonymous
Not applicable

Hi guy !

I am writing a code that automatically dimension column. I have a column not intersect to anything. My code is complete when place the default column , but when I use the spacebar to rotate the column, the dimension does not show up (rotate the column back to the original, then the dimension will appear). Please see the video below to get a better understanding of my problem.Zalo_ScreenShot_24_7_2019_729665.png

 

 

 

 

 

 

0 Likes
Accepted solutions (2)
2,915 Views
8 Replies
Replies (8)
Message 2 of 9

yimin.chenTW
Alumni
Alumni

Hi @Anonymous ,

 

The video you posted is not available now.

Would you mind uploading it again?

Yimin Chen
Developer Consultant
Developer Technical Services
Autodesk
0 Likes
Message 3 of 9

BobbyC.Jones
Advocate
Advocate
Accepted solution

The geometry retrieved from instance.SymbolGeometry is "in the local coordinate space of the symbol", as stated in the docs.  You will need perform some transforms, using the Transform returned from Instance.GetTransform(), in your vector comparisons.

--
Bobby C. Jones
Message 4 of 9

Anonymous
Not applicable

Hi @yimin.chenTW 

I fixed it, can you watch it?

 

 

0 Likes
Message 5 of 9

Anonymous
Not applicable

HI @BobbyC.Jones !

Would you please give me detailed instructions? Thank you !

 

 

0 Likes
Message 6 of 9

BobbyC.Jones
Advocate
Advocate
Accepted solution

 

    var instanceTransform = columnFamilyInstance.GetTransform();

foreach (Face face in solidCol.Faces) { var normal = face.ComputeNormal(uv); var instanceNormal = instanceTransform.OfVector(normal); if (instanceNormal.IsAlmostEqualTo(XYZ.BasisY) || instanceNormal.Negate().IsAlmostEqualTo(XYZ.BasisY)) { referenceArrayX.Append(face.Reference); }
//... }
--
Bobby C. Jones
0 Likes
Message 7 of 9

yimin.chenTW
Alumni
Alumni

Hi @Anonymous 

it's available now.

Yimin Chen
Developer Consultant
Developer Technical Services
Autodesk
0 Likes
Message 8 of 9

Anonymous
Not applicable

I was successful. Thank you very much @BobbyC.Jones 

 

 

Message 9 of 9

yimin.chenTW
Alumni
Alumni

@Anonymous good to see you got your answer from @BobbyC.Jones .

Here's another approach for what you want, just for your reference.

 

foreach(Face f in solid.Faces)
{
     if (f.ComputeNormal(new UV(0.5,0.5)).IsAlmostEqualTo(XYZ.BasisZ.Negate())) //get bottom face
     {
         foreach(EdgeArray edgeArr in f.EdgeLoops)
         {
             foreach(Edge edge in edgeArr)
             {
                 ReferenceArray refArray = new ReferenceArray();
                 refArray.Append(edge.GetEndPointReference(0));
                 refArray.Append(edge.GetEndPointReference(1));
                 XYZ offsetVec = instanceTransform.OfVector(edge.Evaluate(0.5)).Normalize();

                 XYZ p1 = instanceTransform.OfPoint(edge.Evaluate(0)) + offsetVec;
                 XYZ p2 = instanceTransform.OfPoint(edge.Evaluate(1)) + offsetVec;
                 Line line = Line.CreateBound(p1, p2);
                 doc.Create.NewDimension(doc.ActiveView,line , refArray);
              }
          }
     }
}
Yimin Chen
Developer Consultant
Developer Technical Services
Autodesk