Inventor Crashes when creating a new idw with ilogic, only happens in vault project

Inventor Crashes when creating a new idw with ilogic, only happens in vault project

rswearingenKCK24
Explorer Explorer
331 Views
2 Replies
Message 1 of 3

Inventor Crashes when creating a new idw with ilogic, only happens in vault project

rswearingenKCK24
Explorer
Explorer

I have created an idw template that runs some ilogic upon creating a new document.  The ilogic brings up a message box to choose the part type, which changes the titleblock and starts a new base view. Upon clicking "ok" or "cancel" in the new drawing view dialog box Inventor crashes.   This only occurs when in a Vault project.  When in a non-Vault project it works flawlessly.

 

I created a copy that does not run the ilogic rule upon creating a new document, and run the rule manually and there is no problem.

 

I would really like to use this in our work flow.  Any help would be greatly appreciated.

 

I have included a gif of the crash, the ilogic rule, and a copy of the template and a couple parts to test.

 

INV CRASH.gif

If iProperties.Value("Project", "Description") = "" Or iProperties.Value("Project", "Description") <> "" Then
	Question = InputListBox("What type of part is this?", MultiValue.List("TITLE"), TITLE, Title := "Part Types", ListName := "List")
End If

If Question = "PLATE" Then 
	TITLE = "PLATE" 
ElseIf Question = "LINEAR" Then 
	TITLE = "LINEAR" 
ElseIf Question = "SHAFT" Then 
	TITLE = "SHAFT" 
End If

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet
Dim oView As DrawingView

Dim oCommandMgr As CommandManager 
oCommandMgr = ThisApplication.CommandManager 

' Get control definition for the line command. 
Dim oControlDef As ControlDefinition 
 oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBaseViewCmd")  
 oControlDef.Execute2(True)

 (Upon looking at the code I realize the second if/else statement is a bit redundant, but I'm pretty sure that's not causing the problem.)

0 Likes
332 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

try this way

Dim oControlDef As ControlDefinition 
 oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBaseViewCmd")  
 oControlDef.Execute

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 3 of 3

rswearingenKCK24
Explorer
Explorer

Thanks. That seems to be working.  I will continue testing to be sure.

I have a similar idw template for assemblies, that creates a part list after the view is created.  This one would also cause crashes.  When I changed the code as you suggested it throws an ilogic error and does not create the part list.  Any suggestions on how to fix it?  

 

Here is the code.  I think it has some thing to do with the "oSheet.DrawingViews(1)"

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet
Dim oView As DrawingView

Dim oCommandMgr As CommandManager 
oCommandMgr = ThisApplication.CommandManager 
 
Dim oControlDef As ControlDefinition 
 oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBaseViewCmd")  
 oControlDef.Execute
 
oView = oSheet.DrawingViews(1)
	
Dim oBorder As Border
    oBorder = oSheet.Border
	
Dim oPlacementPoint As Point2d
    
        xrev = oBorder.RangeBox.MaxPoint.X - 0.3175
        yrev = oBorder.RangeBox.MaxPoint.Y - 0.3175
        
        oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(xrev, yrev)
    

Dim oPartsList1 As PartsList
oPartsList1 = oSheet.PartsLists.Add(oView, oPlacementPoint, PartsListLevelEnum.kPartsOnly)
oPartsLis1t = oDoc.ActiveSheet.PartsLists.Item(1)

 

0 Likes