Autodesk Inventor Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You can use AIGDT font to the FormattedText to show symbols:
<StyleOverride Font='AIGDT' Bold='False'>n</StyleOverride>

Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Amazing!
Could you please give me the materials for some special symbol in Format Text? I cannot find out where I can read them.
For instance: DimensionValue, SectionViewName, etc........
I got a problem in dimension that is I cannot use GeneralDimensions.AddLinear to dimension between a centerline and a line curve
'oCLine100 is the center line, oLCurve100 is the line curve. Two lines is parallel. oDimPos is the point 2d
Dim oGI100, oGI101 As GeometryIntent
Set oGI100 = oSheet.CreateGeometryIntent(oLCurve100)
Set oGI101 = oSheet.CreateGeometryIntent(oCLine100)
Dim oLDim100 As LinearGeneralDimension
Set oLDim100 = oSheet.DrawingDimensions.GeneralDimensions.AddLine
Please help me to figure out what goes wrong in the code????
This GeneralDimensions.AddLinear() is really terrible. It make my Inventor crash down more than 15 time per day........... although I use "On Error Resume Next" before the code line or not.
-----------------------------------------------------------------------------------------
Toan
Inventor API
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sometimes, the problem shows out like this following figure:
But sometimes, Inventor crash down like this
For average 30 minutes for one crash like this. If I use the GeneralDimensions.AddLinear 3 or 4 times, it crash down immediately.
Autodesk men, please check out, I am tired of crash and reopen Inventor and crash and reopen..................................so annoyed
If you can find out the solution, please make the hot-fix for it!!!!!!!!!!!
-----------------------------------------------------------------------------------------
Toan
Inventor API
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
In API help, you can search the topic titled "XML Tags for FormattedText" to understand more details about FomattedText.
Can you attach a data to reproduce the failure for adding the diametric linear dimension?

Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sorry, but it is the company properties, I don't have the permission to attach.......
But I really DO NOT understand why.
First,
I change the code to dimension for two line segment curves, which is only different in Y position, every else is same.
Then I create the Center Line by two kStartPoint of two lines, it worked
This means that these two GeometryIntent are right. Then the AddLinear() not work with these two GeometryIntent
If I don't create CenterLine AddLinear also didn't work!!!!!!! Run two or three time, Inventor crashs down........
---> Unbelievable
Then, I change to the most simple case. I get two geometry intent that is the StartPoint and EndPoint of a line curve.
AddLinear didn't work too. What happens??????????
Do you believe this?????
In two case, I change the color and weight of curves, and it work well---> this means that the curves is not nothing and they are right!
So, assuming that I don't understand and I write wrong code?????? Why Inventor crashes??????????? Today, I got more than 20 crashes, it is really irritated.
I know that this sounds stupid, but it was. Now I will try to make a sample to test and send for you........
-----------------------------------------------------------------------------------------
Toan
Inventor API
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I just create a simple test, it can work, and the List of Properties/Methods can work also
In my macro, even I press Ctrl+J, it not work??????
Or the wrong thing happens because my code is too long???????????????
About 3000 lines and will be 5000 lines if I can use AddLinear to dimension the drawing..................
How I can solve this problem???? Please help!!!!
-----------------------------------------------------------------------------------------
Toan
Inventor API
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
If the data is protected, can you create another simple sample to reproduce the issue which you think is safe to attach? Or you can try to select a line segment curve on a drawing, and then run below VBA code to check if it works:
Sub CreateLinearDiametricDim()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oCurve As DrawingCurve
Set oCurve = oDoc.SelectSet(1).Parent
Dim oIntent1 As GeometryIntent, oIntent2 As GeometryIntent
Set oIntent1 = oDoc.ActiveSheet.CreateGeometryIntent(oCurve, kStartPointIntent)
Set oIntent2 = oDoc.ActiveSheet.CreateGeometryIntent(oCurve, kEndPointIntent)
Dim oDim As LinearGeneralDimension
Dim oPt As Point2d
Set oPt = ThisApplication.TransientGeometry.CreatePoint2d(12 , 12)
Set oDim = oDoc.ActiveSheet.DrawingDimensions.GeneralDimensio ns.AddLinear(oPt, oIntent1, oIntent2, kDiametricDimensionType)
End Sub
As the issue for display the List of Properties/Methods, can you check if there are two subs which have the same name in the module/class?

Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I just think to new solution that doesn't need to dimension automatic by VBA anymore.
Maybe in my next project, we will discuss more. Thank you so much!
I have a question about DrawingView:
How I can Delete the oBaseView but still exist the oIsoView????
If we do this manually, we can choose No when a prompt appear and ask us to Delete Projected Views or not
But I don't see any option in DrawingView.Delete() method.
-----------------------------------------------------------------------------------------
Toan
Inventor API
Re: Drawing Automation with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sorry for me,
I just try and only the obaseview is deleted; the isoview still be there. It's no need to do anything else, thanks IV for this!
-----------------------------------------------------------------------------------------
Toan
Inventor API


