Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Save As (dwg) if file is idw

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
mjtubos
4126 Views, 6 Replies

iLogic Save As (dwg) if file is idw

hello friends

I made a rule to save as dwg.

 

    ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".dwg"),True)
    MessageBox.Show(ThisDoc.FileName(False)& ".dwg  Saved!! " & vbCrLf & vbCrLf & ThisDoc.Path , "Save As")

 

I wonder if it is possible to implement this rule, so it is executed only if you are saving a file in IDW

.
If the file to be saved is a ipt, for example, do not run the save as.

That is, the question is how to know the extension of the newly saved file to test the rule save as?

 

thank you for your attention

Marcus Roberto Jung
Mechanical Engineer / / Porto Alegre / / Brazil

Inventor Pro 2013
Intel Core i7 12GB RAM
Windows 7 - 64bits
6 REPLIES 6
Message 2 of 7
Curtis_Waguespack
in reply to: mjtubos

Hi mjtubos,

 

This should work:

 

 

 'check file type
If ThisDoc.Document.DocumentType <> kDrawingDocumentObject Then
MessageBox.Show("This file is not a drawing file.", "iLogic")
Else
ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".dwg"),True)
MessageBox.Show(ThisDoc.FileName(False)& ".dwg  Saved!! " & vbCrLf & vbCrLf & ThisDoc.Path , "Save As")
End If

 I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 3 of 7
mjtubos
in reply to: Curtis_Waguespack

Dear Curtis

 

Thanks for the prompt solution of my question.

I implemented this code, saving the DWG document in a new directory. I do not know if it would be the best solution, but it worked.

 

greetings

 

Marcus Jung

 

 

Dim odoc As Document

oDoc = ThisApplication.ActiveDocument

Dim assemblyPath As String = "E:\Desenhos Marcus\Inventor\_newdir"
Dim assemblyFileName As String = System.IO.Path.GetFileName(oDoc.FullFileName)
Dim assemblyFileNameNoExt As String = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)
Dim driverPathAndFileName = assemblyPath + "\" + assemblyFileNameNoExt + ".dwg"



If ThisDoc.Document.DocumentType <> kDrawingDocumentObject Then
    MessageBox.Show("This file is not a drawing file.", "iLogic")
Else
    ThisDoc.Document.SaveAs(driverPathAndFileName , True)
    MessageBox.Show(ThisDoc.FileName(False)& ".dwg  Saved!!! " & vbCrLf & vbCrLf & assemblyPath , "Save As")
End If

Marcus Roberto Jung
Mechanical Engineer / / Porto Alegre / / Brazil

Inventor Pro 2013
Intel Core i7 12GB RAM
Windows 7 - 64bits
Message 4 of 7
swordmaster
in reply to: mjtubos

there are two types of .dwg in inventor (at least in INV2009)

Autodesk Inventor drawings

AutoCad drawings

 

which type will be created by running the code posted?

Inventor 2010 Certified Professional
Message 5 of 7
mjtubos
in reply to: swordmaster

hello

 

to run the rule above, the file is saved in dwg format Autocad 2007 Drawing.


But that is because I had previously set up by the "Save copy as"  the file version for Autocad 2007 Drawing.

Also I wonder if it is possible to do this configuration file version by iLogic code

 

best regards

Marcus Roberto Jung
Mechanical Engineer / / Porto Alegre / / Brazil

Inventor Pro 2013
Intel Core i7 12GB RAM
Windows 7 - 64bits
Message 6 of 7
bent.p
in reply to: mjtubos

I was reading the code for save Dwg file above

 

In my case, i need to save it in Inventor dwg  version,  as if you go to export drawing.

so when i open the drawing in a viewer i see the sheet,,  Is that posible with the Ilogic?

 

Thanks for the help

Message 7 of 7

Hello,

 

This is in regards with query of Ilogic functionality of Inventor

I have an assembly file say “xyz.iam” and corresponding drawing file by name “xyz.dwg”

Now I am going make dimension changes in assembly file “xyz.iam”, as we know that these changes will propagate to “xyz.dwg” as well.

 

My query is, whenever I make dimensional changes in “xyz.iam”, illogic have to ask me to rename or change the name of drawing sheet.

 

I am aware of itrigger option.

 

Please let me know the sample illogic code to perform the above mentioned operation

Thanking you in anticipation.

Mahesh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report