Initialising PropertySets ("Design Tracking Properties") of newly created model states

Initialising PropertySets ("Design Tracking Properties") of newly created model states

Anonymous
Not applicable
1,026 Views
1 Reply
Message 1 of 2

Initialising PropertySets ("Design Tracking Properties") of newly created model states

Anonymous
Not applicable

Hello

 

I'm trying to alter some "Design Tracking Properties" of a newly created model state, whose properties have not been touched.

 

I can't seem to access the property set (through `ModelState.Document.PropertySets("Design Tracking Properties")`, despite being able to do so for others), which I guess means it doesn't exist yet.

 

Is there a way to initialise it somehow?

 

I found the following from another discussion about initialising the event trigger property set, but my application here doesn't work, and I can't see how to fix it:

 

 

InitializePropSet(oModelState.Document)
oDesignPropSet = oModelState.Document.PropertySets("Design Tracking Properties")

...

Sub InitializePropSet(ByRef oDoc As Document)
	Dim sInternalName As String = "{32853F0F-344-11D1-9E93-0060B03C1CA6}"
    Dim oSet As PropertySet
	If Not oDoc.PropertySets.PropertySetExists(sInternalName, oSet) Then
		oSet = oDoc.PropertySets.Add("Design Tracking Properties", sInternalName)
	End If
    Dim oTempProp As Inventor.Property = oSet.Add("", "Stock Number", 55)
    oTempProp.Delete
    oDoc.Update
End Sub

 

 

Actually I've run some more tests, and at this point I'm not even sure how I have any model states working. Altering the property sets manually for the ostensibly unitialised model states doesn't fix the issue.

 

Thanks

0 Likes
Reply (1)
Message 2 of 2

Anonymous
Not applicable

So the file I was using was somehow broken. I created a new file, performed the same steps, and it seems like the file needs to be saved before the new model state's property sets are created automatically.

 

Still, if anyone knows a way to initialise it early, it would save me a lot of trouble.

0 Likes