Ordinate Set Dimension Program

Ordinate Set Dimension Program

richie_tony007
Participant Participant
242 Views
2 Replies
Message 1 of 3

Ordinate Set Dimension Program

richie_tony007
Participant
Participant

Hi All,

i want to create a ordinate dimension set with this code

but i end up getting errors 

can anyone help please

Dim inv = ThisApplication
Dim oDoc = ThisDrawing.Document
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim Face0 = VIEW1.GetIntent("Face0")
Dim Face1 = VIEW1.GetIntent("Face1")
Dim Face2 = VIEW1.GetIntent("Face2")
Dim CurSht As Inventor.Sheet
Dim ordSet1 As OrdinateDimensionSet
ordSet1 = CurSht.DrawingDimensions.OrdinateDimensionSets.Add(Face0,Face1,DimensionTypeEnum.kVerticalDimensionType)

 

0 Likes
Accepted solutions (1)
243 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @richie_tony007.  This is not really my area of focus, but I think I see the problem.  Also, it looks like your code is crossing over from purely iLogic stuff, into Inventor API stuff, which I am more familiar with.

First of all, you just created the variable named 'CurSht', but never assigned it a value.  Then two lines later, you are trying to use that variable to start off a line of code, which won't work, because it has no value to work with.  I'm not sure why you did not just reuse the similar variable named ''Sheet_1' from earlier in the code, but that's what I am doing in my edited example below.  You will notice the term 'NativeEntity' included in the last line of code.  That is where it is going from a purely iLogic object type of 'IManagedDrawingDimensions' to the Inventor API object type of 'DrawingDimensions'.  After that point, it can access the Inventor API OrdinateDimensionSets object, and its Add method (OrdinateDimensionSets.Add).  As you can see in the online help documentation, the first 'input' it is asking for is an ObjectCollection with the GeometryIntent type objects in it.  Then it wants the 'placement point' (a transient Point2d object) to be specified.  Then the dimension type.

Dim inv = ThisApplication
Dim oDoc = ThisDrawing.Document
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim Face0 = VIEW1.GetIntent("Face0")
Dim Face1 = VIEW1.GetIntent("Face1")
Dim Face2 = VIEW1.GetIntent("Face2")
Dim oObjsColl As ObjectCollection = inv.TransientObjects.CreateObjectCollection()
oObjsColl.Add(Face0)
oObjsColl.Add(Face1)
oObjsColl.Add(Face2)
Dim oPlacementPt As Point2d = inv.TransientGeometry.CreatePoint2d(3,3)
Dim ordSet1 As OrdinateDimensionSet
ordSet1 = Sheet_1.DrawingDimensions.NativeEntity.OrdinateDimensionSets.Add(oObjsColl, oPlacementPt, DimensionTypeEnum.kVerticalDimensionType)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

richie_tony007
Participant
Participant

Thanks Heaps! 

And Thanks for the detailed Explanation 

Much Appreciated 🙂 @WCrihfield 

0 Likes