Need to open Create New File dialog box to choose the template

Need to open Create New File dialog box to choose the template

RoyWickrama_RWEI
Advisor Advisor
1,376 Views
8 Replies
Message 1 of 9

Need to open Create New File dialog box to choose the template

RoyWickrama_RWEI
Advisor
Advisor

https://forums.autodesk.com/t5/inventor-customization/ilogic-and-derive/m-p/3563400#M39458

I am using the code in above posting: Thanks to Curtise Weguspack and others.

However, I need to have the "Create New File" dialog box open so that I can choose the template to continue.

Rule is attached here to.

 

I request help - Thanks.

 

SBS-LAF-p0013_1.png

SBS-LAF-p0013_2.png

0 Likes
Accepted solutions (1)
1,377 Views
8 Replies
Replies (8)
Message 2 of 9

bradeneuropeArthur
Mentor
Mentor

There is a file dialog option in the custom snippets in ilogic. This should be used. The code is easy to use. If needed I can take a look to prepare the complete code tomorrow.

 

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 9

RoyWickrama_RWEI
Advisor
Advisor

Thanks. I looked in to the snippets. I found some useful snippet codes.

But, I can't get around with what I need.

 

Upon creation, I need to have the option to select the template (sheet or part) - Could you fix? Sorry for bothering you. Thanks a lot.

 

Dim iLNO As String = "0001P"
oPath_and_FileName = ThisDoc.PathAndFileName(False) ' without extension

oQuestion = MessageBox.Show("Do you want to derive this file?", iLNO, MessageBoxButtons.YesNo)
If oQuestion = vbNo Then
Return
Else

' Create a new part file to derive the selected part into 
'note: kPartDocumentObject is the default template
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject)) 

'Create a derived definition for the selected part
Dim oDerivedPartDef As DerivedPartUniformScaleDef
oDerivedPartDef = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.CreateUniformScaleDef(ThisDoc.PathAndFileName(True))

' set the scale to use
oDerivedPartDef.ScaleFactor = 1

'define the mirror plane
'kDerivedPartMirrorPlaneXY = 27393 
'kDerivedPartMirrorPlaneYZ = 27394 
'kDerivedPartMirrorPlaneXZ = 27395 
oDerivedPartDef.MirrorPlane = 27394 

' Create the derived part.
oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Add(oDerivedPartDef)

' Save the new derived part.
oPartDoc.SaveAs(oPath_and_FileName & "_derived.ipt", False)
oPartDoc.Close
MessageBox.Show("New file created at:" & vbLf & oPath_and_FileName & "_derived.ipt", iLNO)

End If
0 Likes
Message 4 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@RoyWickrama_RWEI 

 

InputRadioBox function in iLogic may be useful to select type of document (Part or sheet). For more details, refer below help documentation link.

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014...

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 5 of 9

bradeneuropeArthur
Mentor
Mentor

Hi,

what do you exactly need?

do you want to derive either to a sheetmetalpart.ipt or a standardpart.ipt!?

and you want to choose between them right?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 9

RoyWickrama_RWEI
Advisor
Advisor

Thanks for the reply.

 

In case the derived part created going to be a sheet metal part, I need to have the option to select the sheet metal template from the new file create dialog box.  Currently, it is a standard (non sheet-metal).

It may not be necessary to have the new file open dialog box, if if is possible other way around.

Thanks again.

 

0 Likes
Message 7 of 9

RoyWickrama_RWEI
Advisor
Advisor

Thanks. But, I need to have the option to choose the file template from the Create New File dialog box. In case the part is of sheet metal, converting to sheet metal is not the same as the sheet metal created from sheet metal template.

 

Currently, it goes to a  standard (non sheet metal) where I don't know template came from!

 

I appreciate if you could shed some light on my request!

0 Likes
Message 8 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@RoyWickrama_RWEI ,

 

You can specify the path of sheet metal template while creating new part document.

 
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, path of sheet metal template)

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 9 of 9

RoyWickrama_RWEI
Advisor
Advisor

Great. Thanks. It works.

 

(I still prefer to do with File > New dialog box because the rule is now machine dependent)

 

0 Likes