iLogic

iLogic

Anonymous
Not applicable
955 Views
7 Replies
Message 1 of 8

iLogic

Anonymous
Not applicable

Hello all!

 

I am working on a rule that will automatic open a new drawing upon close of a new ipt or iam. I have been able to open the template file from the code, however I haven't been able to open a new drawing based on the template as it would happen if I did it manually.

is there a code to create a new file(idw) based on my template?

 

Thanks in advance!

-Daniel

0 Likes
Accepted solutions (1)
956 Views
7 Replies
Replies (7)
Message 2 of 8

mcgyvr
Consultant
Consultant
Accepted solution
question = MessageBox.Show("Do you want to create a drawing?", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
'set condition based on answer
 If question = vbYes Then
'create drawing
Dim oDrawingDoc As DrawingDocument    
Dim IDWTemplate As String = "FULL PATH TO TEMPLATE GOES HERE"
oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, IDWTemplate,True)
End If


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 8

Mark.Lancaster
Consultant
Consultant

@Anonymous

 

Welcome to the community...

 

Besides @mcgyvr information you may want to share your code so others can see what you have...  I bet @Curtis_Waguespack can assist as well.

 

 

@mcgyvr  I didn't realize you could write code...   Smiley Very Happy

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

Message 4 of 8

Curtis_Waguespack
Consultant
Consultant

quick example:

 

    ' Create a new part document, using the default part template.
    Dim oPartDoc As PartDocument
    oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
    ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
	
	MessageBox.Show("This is a new part file.", "iLogic")

 

 

 

re-do, to match mcgyvr's example more closely, for clarity:

 

' Create a new part document, using the default part template.
Dim oTemplate As String = ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject)

Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, oTemplate)

MessageBox.Show("This is a new part file.", "iLogic")

 

EESignature

0 Likes
Message 5 of 8

mcgyvr
Consultant
Consultant

@Mark.Lancaster wrote:

 

 

@mcgyvr  I didn't realize you could write code...   Smiley Very Happy


@Mark.Lancaster 

You should see me run my Singer sewing machine... Mad skillz as the kids say (or used to say) Smiley LOL

Just another tool on the ole swiss army knife... 

 

Nah...I'm just decent at copying chunks from Curtis.. He's got code for just about everything floating all over the interweb.. 

 

...11 minutes left...

do.. do.. do.. do..

do.. ..do.. do

10 minutes left...

do.. do.. do.. do..

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 6 of 8

Curtis_Waguespack
Consultant
Consultant

@mcgyvr wrote:

 

...11 minutes left...

do.. do.. do.. do..

do.. ..do.. do

10 minutes left...

do.. do.. do.. do..

 

 


you could read about your good old days as you wait:

http://macgyver.wikia.com/wiki/List_of_problems_solved_by_MacGyver

EESignature

0 Likes
Message 7 of 8

Mark.Lancaster
Consultant
Consultant

The good ole days when MacGyver was on TV...  Smiley Very Happy

 

Seeing that article makes me feel even older now..  Smiley Sad  Thanks @Curtis_Waguespack

 

 

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 8 of 8

Curtis_Waguespack
Consultant
Consultant

@Mark.Lancaster wrote:

 

Seeing that article makes me feel even older now..  Smiley Sad 


me too, but...

 

... just imagine how he's going to feel when they replace him with a new, younger version this fall: Smiley Wink

http://www.imdb.com/title/tt1399045/

EESignature

0 Likes