Referencing a model from a yet empty IDW template

Referencing a model from a yet empty IDW template

Anonymous
Not applicable
418 Views
2 Replies
Message 1 of 3

Referencing a model from a yet empty IDW template

Anonymous
Not applicable

Hi,

 

so usually, if you have got an IDW with a view, and you run a rule from that IDW, you can easily reference the model like this for example:

oFileName = ThisDrawing.ModelDocument.FullFileName

 

 Now I want to create an IDW template with the following event trigger: "New Document fires when a document is created from a template. " starting a rule. So that when I create a drawing for a saved model of mine, the rule starts first thing and I can choose a sheet format from a list for example.

 

My problem now is, that the rule triggers when there is not yet a view on the IDW. Only after the rule can I place a view. Only then can I reference the model in the above mentioned ways. And I want the choice of sheet format depend on the name of the model.

 

Correct me if I'm wrong, but Inventor itself does have a reference to the model in the empty IDW: It let's you place a view from the model from which you opened the IDW template. Can I maybe go this way to get my reference? Or ist it impossible? Or is there another way?

 

I don't want to go the way of first placing the view, then running the code, I need the code run first thing with a reference to the model.

 

Thank you for your time!

0 Likes
Accepted solutions (1)
419 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

I would suggest that, if you don't want to go the route of an Add-in and EventHandlers, which can slow down Inventor, that you use a rule that creates the new drawing document, then places that first view (or uses the SheetFormat) and already has a reference to the Model file you want to use within the drawing.  This way it knows the model file before the drawing is started, and can bypass the Event Trigger issue, running before you place your first view.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Anonymous
Not applicable

Hey,

 

Great workaround! So instead of typing the shortcut to create a drawing and then running the code, I press a shortcut running code from the model which includes the creation of the drawing.  That I haven't thought of this myself! So obvious in hindsight.  Thank you!

0 Likes