Inventor Customization

Inventor Customization

Reply
Member
5 Posts
0 Kudos
Registered: ‎04-20-2010
Post 1 of 7
Accepted Solution

iLogic Save As (dwg) if file is idw

1205 Views, 6 Replies
01-03-2013 08:09 AM

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

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

*Expert Elite*
3,002 Posts
1,702 Kudos
Registered: ‎03-08-2006
Post 2 of 7

Re: iLogic Save As (dwg) if file is idw

01-03-2013 08:36 AM 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



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Member
5 Posts
0 Kudos
Registered: ‎04-20-2010
Post 3 of 7

Re: iLogic Save As (dwg) if file is idw

01-03-2013 09:15 AM 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
Distinguished Mentor
541 Posts
33 Kudos
Registered: ‎12-15-2008
Post 4 of 7

Re: iLogic Save As (dwg) if file is idw

01-03-2013 01:32 PM 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
Member
5 Posts
0 Kudos
Registered: ‎04-20-2010
Post 5 of 7

Re: iLogic Save As (dwg) if file is idw

01-04-2013 03:30 AM 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
New Member
2 Posts
0 Kudos
Registered: ‎01-20-2005
Post 6 of 7

Re: iLogic Save As (dwg) if file is idw

09-21-2013 04:57 AM 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

Active Contributor
30 Posts
0 Kudos
Registered: ‎07-24-2014
Post 7 of 7

Re: iLogic Save As (dwg) if file is idw

08-24-2014 07:29 AM in reply to: Curtis_Waguespack

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post