iLogic New Drawing from Template: Select Component for View

iLogic New Drawing from Template: Select Component for View

kmlarrivee
Enthusiast Enthusiast
645 Views
5 Replies
Message 1 of 6

iLogic New Drawing from Template: Select Component for View

kmlarrivee
Enthusiast
Enthusiast

Hi all! 

 

I've created a .idw drawing that already contains views and dimensions from a template model (ipt).

I have a rule that creates a new drawing from this template using this line

Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, templateFile, True)

However when the new drawing is created, the model and dimensions are not present. I am sure that this is due to the fact that when I manually (no iLogic) create a new drawing for this template I get a popup window to "Select Component for View". I have not found a way to specify this Component via iLogic hence the template is opened without the views and dimensions.

kmlarrivee_0-1709924504788.png

Anyone have a clue on how to do this? The objective is to then replace the model reference with a newly created part (which is based on the original template model)

 

Thanks!

0 Likes
646 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @kmlarrivee.  That sounds like a good case for using the ThisApplication.CommandManager.PostPrivateEvent method, where you specify PrivateEventTypeEnum.kFileNameEvent as the first input, then the full file name of the model document as the second input.  You would use that line of code just before the line of code that creates the new drawing.  Then that should automatically fill in that information for you.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

kmlarrivee
Enthusiast
Enthusiast

@WCrihfield 

This does work indeed!

 

However, when the drawing opens, the model is there but the dimensions are gone. I just realised this is the same behaviour as doing it manually...

 

Would there be another way of accomplishing what I want?

 

Thanks,

Keven. 

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

Are you familiar with SheetFormats in drawings?  They are like an internal 'template' for an individual sheet.  It can already include a specific border, title block, notes, and even model views.  However, if it contains model views, it allows you a direct way to specify what model you want to be represented in those views, among other settings.

DrawingDocument.SheetFormats 

SheetFormats 

Sheets.AddUsingSheetFormat 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 6

kmlarrivee
Enthusiast
Enthusiast

[deleted reply]

0 Likes
Message 6 of 6

kmlarrivee
Enthusiast
Enthusiast
I did not know about those, thanks!

However, I have the same problem. I added a Sheet Format in my default template, when using it to generate my final drawing with my new part, the dimensions that were added are not present. 

I guess I need to find a way to use "Replace Model Reference" via iLogic by first copying my template and not creating a new file from it. Let me know if you think of something else. 
0 Likes