Is there has any way to use iam file to create idw file with dimension and balloon with ilogic?

Is there has any way to use iam file to create idw file with dimension and balloon with ilogic?

Anonymous
Not applicable
1,195 Views
11 Replies
Message 1 of 12

Is there has any way to use iam file to create idw file with dimension and balloon with ilogic?

Anonymous
Not applicable

Is there has any way to use iam file to create idw file with dimension with ilogic?

I only can use iam file to create the idw file but I don`t know how to put dimensions and Balloon in to the idw file.

Thanks for any help!

0 Likes
Accepted solutions (2)
1,196 Views
11 Replies
Replies (11)
Message 2 of 12

Michael.Navara
Advisor
Advisor

This is very hard task. Generally is it possible, but iLogic doesn't provide any helpful methods.

Inventor API documentation provides some examples how to create drawing dimensions and balloons. But in real life this is possible only for very special cases.

I implemented my own engine for semi-automatic dimensioning of assembly drawing and it has hundreds of lines of code.

0 Likes
Message 3 of 12

Anonymous
Not applicable

Thank you for your reply Michael!  Is the that possible to pull out the Mate  or Flush `s parameters out and to show the dimension  in the drawing?

0 Likes
Message 4 of 12

Michael.Navara
Advisor
Advisor

This is possible, but you need to find a drawing geometry which belongs to face or edge.

Main steps for this goal is

  • Get FaceProxy from Mate (MateConstraint.EntityOneMateConstraint.EntityTwo)
  • Get DrawingCurves which belongs to face in appropriate DrawingView (DrawingView.DrawingCurves(faceProxy))
  • Select the right DrawingCurve
  • Create GeometryIntent for this curve (Sheet.CreateGeometryIntent(geometry, intent))
  • Select dimension text position (Point2D)
  • Create DrawingDimension (Sheet.DrawingDimensions.GeneralDimensions.AddLinear(...))

Notes:

Generally it does not have to be parallel lines.

For one face you can find more then one curve in drawing view

 

Message 5 of 12

Michael.Navara
Advisor
Advisor
In some cases faceProxy can have NO geometries. All geometries of the face can be hidden or overaly by another geometry
0 Likes
Message 6 of 12

Anonymous
Not applicable

I really appreciate that! Could you give some examples?

0 Likes
Message 7 of 12

Michael.Navara
Advisor
Advisor
Accepted solution

This sample IS NOT FOR PRODUCTION USE!

I omit any error checking for brevity and this rule is written only for this very simple drawing. See attached file for functional example. In the drawing document is local rule with following text.

 

'Get active drawing document, sheet and view
Dim drwDoc As DrawingDocument = ThisDoc.Document
Dim drwSheet As Sheet = drwDoc.Sheets(1)
Dim drwView As DrawingView = drwSheet.DrawingViews(1)

'Get referenced assembly and its component definition
Dim asmDoc As AssemblyDocument = drwDoc.ReferencedDocuments(1)
Dim asmDef As AssemblyComponentDefinition = asmDoc.ComponentDefinition

'Get MateConstraint
Dim mateConstraint As MateConstraint = asmDef.Constraints("MateForDimension")

'Get face proxies from MateConstraint
Dim faceProxy1 As FaceProxy = mateConstraint.EntityOne
Dim faceProxy2 As FaceProxy = mateConstraint.EntityTwo

'Get DrawingCurves which belongs to face in appropriate DrawingView
Dim curves1 As DrawingCurvesEnumerator = drwView.DrawingCurves(faceProxy1)
Dim curves2 As DrawingCurvesEnumerator = drwView.DrawingCurves(faceProxy2)

'Select the right DrawingCurve
Dim curve1 As DrawingCurve = curves1.Item(1)
Dim curve2 As DrawingCurve = curves2.Item(1)

'Create GeometryIntent for this curve
Dim geometryIntent1 = drwSheet.CreateGeometryIntent(curve1)
Dim geometryIntent2 = drwSheet.CreateGeometryIntent(curve2)

'Select dimension text position
Dim textOrigin = drwView.Center

'Create DrawingDimension
drwSheet.DrawingDimensions.GeneralDimensions.AddLinear(textOrigin, geometryIntent1, geometryIntent2)

 

 

 

Message 8 of 12

Anonymous
Not applicable
Accepted solution

Thank you so much!

0 Likes
Message 9 of 12

Anonymous
Not applicable

It show up error as follow:

 

Unable to cast COM object of type 'Inventor._DocumentClass' to interface type 'Inventor.DrawingDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D467-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

0 Likes
Message 10 of 12

Michael.Navara
Advisor
Advisor
0 Likes
Message 11 of 12

Anonymous
Not applicable

I am trying to create the drawing in the assembly.

0 Likes
Message 12 of 12

Anonymous
Not applicable

Could you also have set dimension with flush and set balloon? Thanks

0 Likes