using Transcripts for macros

using Transcripts for macros

philip.G
Enthusiast Enthusiast
1,853 Views
8 Replies
Message 1 of 9

using Transcripts for macros

philip.G
Enthusiast
Enthusiast

Hey Community

 

I only knew macros from Excel. Now I tried to write my own first macro for Inventor witch will export my drawing as a PDF and DXF.

I used the transcript feature to record my action and copy them into my macro.

 

For the PDF Part it worked so far, with the help of some similar posts in this forum.

 

But I'm really stuck with the dxf part.

 

For the transcript you see below I opend Inventor, opend a drawing (a nearly empty drawing I use as a template), exported it and closed inventor again. So the beginning and the end of the transcript are clear for me. 

At the export-part I loaded in my  dxf-config.ini file to make my life easier but it still shows all the line types and other stuff. In my macro I have the problem exactly there. I'm not sure if I can delete that part, but if I comment it out it gives an error as well if I leave it as is. 

I also tried splitting the two long lines so that I wouldn't run in any limitations. But it still gives my various errors. 

 

I'm also not sure why there are lines about DWG export, because I didn't export any. 

 

I hope someone can clarify this for me Smiley Wink 

 

Thanks in advance

 

( I use Inventor 17)

 

 

'Inventor Transcript File
'Autodesk Inventor 2017
'Build: 256, Release: 2017.4.1 - Date: Thu 06/15/2017       
'Build Number: 213256000
'Sat Aug 12 16:16:11 2017
'User Name - Admin
 
Dim Inventor as Application
Dim ActiveDocument as Inventor.Document
 
Inventor.Execute("OpenDocument","DocumentPathName=C:\Users\Public\Documents\Autodesk\Inventor 2017\Templates\pgr.idw;AsTemplate=0;AllowRetry=0;AllowIgnore=0;")
ActiveDocument.Execute("Document1","CheckDocument","DocumentName=Document1;NewDocument=0;Version=6;AllowRetry=0;AllowIgnore=0;")
Inventor.Execute("OpenFrame","DocumentName=Document1;AllowRetry=0;AllowIgnore=0;")
Set ActiveDocument = Inventor.Execute("ActivateDocument","FrameName=Frame1;AllowRetry=0;AllowIgnore=0;")
Inventor.Execute("LoadTransExt","FileExtension=.dxf;TranslatorId={C24E3AC4-122E-11D5-8E91-0010B541CD80};AllowRetry=0;AllowIgnore=0;")
Inventor.Execute("ReadOptionsFile","Options File Path=C:\Users\Admin\Desktop\AddInn\dxf-config.ini;Options File Type=Export;AutoCAD Version=8;Is AutoCADM=0;Use Transmittal=0;Use Customize=0;Customize File=C:\Users\Public\Documents\Autodesk\Inventor 2017\Design Data\DWG-DXF\FlatPattern.xml;Create Layers Group=0;Translate Parts Only=0;Explode Dims=0;Symbols Blocked=1;Selected Properties=[];AutoCAD Template=;Space To Export To=0;Translation Scaling=0;Object Mapping Type=1;Model Views Only=1;File To Be Translated=;Options File Path=;Translate All Sheets=1;Destination DXF=1;Names of Sheets to Translate=[];Line Type File Name=C:\Users\Public\Documents\Autodesk\Inventor 2017\COMPATIBILITY\Support\invDIN.lin;Export Line Type Map=[Continuous:28100:0,000000,DASHED:28101:0,000000,DASHED_SPACE:28102:0,000000,LONG_DASH_DOTTED:28103:0,000000,LONG_DASH_DOUBLE_DOT:28104:0,000000,LONG_DASH_TRIPLE_DOT:28105:0,000000,DOTTED:28106:0,000000,CHAIN:28107:0,000000,DOUBLE_DASH_CHAIN:28108:0,000000,DASH_DOUBLE_DOT:28109:0,000000,DASH_DOT:28110:0,000000,DOUBLE_DASH_DOT:28111:0,000000,DOUBLE_DASH_DOUBLE_DOT:28112:0,000000,DASH_TRIPLE_DOT:28113:0,000000,DOUBLE_DASH_TRIPLE_DOT:28114:0,000000,];Use ACI For Entities And Layers=0;Replace_Spline=0;Chord_Tolerance=0.001;Allow Raster Views=0;AllowRetry=0;AllowIgnore=0;")
' -- Transaction Begin Sat Aug 12 16:18:26 2017
ActiveDocument.Execute("Document1","DWGDataExport","AutoCAD Version=8;Is AutoCADM=0;Use Transmittal=0;Use Customize=0;Customize File=C:\Users\Public\Documents\Autodesk\Inventor 2017\Design Data\DWG-DXF\FlatPattern.xml;Create Layers Group=0;Translate Parts Only=0;Explode Dims=0;Symbols Blocked=1;Selected Properties=[];AutoCAD Template=;Space To Export To=0;Translation Scaling=0;Object Mapping Type=1;Model Views Only=1;File To Be Translated=C:\Users\Admin\Desktop\test\pgr.dxf;Options File Path=;Translate All Sheets=1;Destination DXF=1;Names of Sheets to Translate=[];Line Type File Name=C:\Users\Public\Documents\Autodesk\Inventor 2017\COMPATIBILITY\Support\invDIN.lin;Export Line Type Map=[Continuous:28100:0,000000,DASHED:28101:0,000000,DASHED_SPACE:28102:0,000000,LONG_DASH_DOTTED:28103:0,000000,LONG_DASH_DOUBLE_DOT:28104:0,000000,LONG_DASH_TRIPLE_DOT:28105:0,000000,DOTTED:28106:0,000000,CHAIN:28107:0,000000,DOUBLE_DASH_CHAIN:28108:0,000000,DASH_DOUBLE_DOT:28109:0,000000,DASH_DOT:28110:0,000000,DOUBLE_DASH_DOT:28111:0,000000,DOUBLE_DASH_DOUBLE_DOT:28112:0,000000,DASH_TRIPLE_DOT:28113:0,000000,DOUBLE_DASH_TRIPLE_DOT:28114:0,000000,];Use ACI For Entities And Layers=0;Replace_Spline=0;Chord_Tolerance=0.001;Allow Raster Views=0;AllowRetry=0;AllowIgnore=0;")
' -- Transaction End Sat Aug 12 16:18:26 2017 (ReqId=1)
 
Inventor.Execute("CloseFrame","FrameName=Frame1;AllowRetry=0;AllowIgnore=0;")
Set ActiveDocument = Inventor.Execute("ActivateDocument","AllowRetry=0;AllowIgnore=0;")
Inventor.Execute("CloseDocument","DocumentName=Document1;AllowRetry=0;AllowIgnore=0;")
0 Likes
Accepted solutions (2)
1,854 Views
8 Replies
Replies (8)
Message 2 of 9

philip.G
Enthusiast
Enthusiast
Maybe I need to ask a bit more specific.Smiley Tongue
 
If I run this code below it gives my an error. 
 
1. can I / should I remove even more lines at the beginning (Check document-stuff) and end (DWG-stuff)
 
2. Can the transcript function be used like this, or should I start from scratch with .net? 
 
I hope someone can help my 😄
 
 
Dim Inventor as Application
Dim ActiveDocument as Inventor.Document
 
 
ActiveDocument.Execute("Document1","CheckDocument","DocumentName=Document1;NewDocument=0;Version=6;AllowRetry=0;AllowIgnore=0;")
Inventor.Execute("OpenFrame","DocumentName=Document1;AllowRetry=0;AllowIgnore=0;")
 
Set ActiveDocument = Inventor.Execute("ActivateDocument","FrameName=Frame1;AllowRetry=0;AllowIgnore=0;")
 
Inventor.Execute("LoadTransExt","FileExtension=.dxf;TranslatorId={C24E3AC4-122E-11D5-8E91-0010B541CD80};AllowRetry=0;AllowIgnore=0;")
Inventor.Execute("ReadOptionsFile","Options File Path=C:\Users\Admin\Desktop\AddInn\dxf-config.ini;Options File Type=Export;AutoCAD Version=8;Is AutoCADM=0;Use Transmittal=0;Use Customize=0;Customize File=C:\Users\Public\Documents\Autodesk\Inventor 2017\Design Data\DWG-DXF\FlatPattern.xml;
 
ActiveDocument.Execute("Document1","DWGDataExport","AutoCAD Version=8;Is AutoCADM=0;Use Transmittal=0;Use Customize=0;Customize File=C:\Users\Public\Documents\Autodesk\Inventor 2017\Design Data\DWG-DXF\FlatPattern.xml;C
0 Likes
Message 3 of 9

b_sharanraj
Advocate
Advocate
Accepted solution

Hi @philip.G

 

Why you need to do this much when you can do it with some piece of iLogic Code. Please try the below iLogic Code

 

ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".dxf"), True)

Regards

B.Sharan Raj

Message 4 of 9

philip.G
Enthusiast
Enthusiast

Thanks for your answer!

 

I already shut down my CAD-Workplace but I will try it out asap. 

Is this also true for PDF?

0 Likes
Message 5 of 9

b_sharanraj
Advocate
Advocate
Accepted solution

Yes it's same code just you have to Change the extension as .pdf

 

But the code work only for a single sheet in a drawing for multiple sheet please look in to below page which is developed by @Curtis_Waguespack

 

http://inventortrenches.blogspot.com/2011/07/ilogic-to-save-pdf-files-to-new.html

 

Regards

B.Sharan Raj

Message 6 of 9

philip.G
Enthusiast
Enthusiast

Thanks @b_sharanraj

 

I will definitely try it out

....tomorrow Smiley Wink

0 Likes
Message 7 of 9

philip.G
Enthusiast
Enthusiast

@b_sharanraj

 

This worked so well. OMG!

 

I didn't knew that this was even possible with I Logic. ☺

I tried it out and with the first run it worked. Thanks you so much Smiley Very Happy

 

Now I have a running Rule, and with time I can try to make a real Addin out of it. (my next goal. ☺ but for the future. For now I'm just impressed of the capabilities of I-logic)

 

Thanks again!

0 Likes
Message 8 of 9

b_sharanraj
Advocate
Advocate

@philip.G

 

Still a lot can be done using iLogic 🙂

 

For further Assistance if you need can ask in Forums / Personally 🙂

Regards

B.Sharan Raj

0 Likes
Message 9 of 9

philip.G
Enthusiast
Enthusiast

I'll remember, thanks Smiley Happy

0 Likes