- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.EntityOne, MateConstraint.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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Do you run the code from Drawing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report