UserDataMap python plugin 2005-03-09 - By benp
Back posted for a colleague:
-- ----8<-- ----
Hi XSI List, I am currently working on a python self-installing plugin to set up a templated UserDataMap on clusters (of edges, in this case) on a polymesh. I have got to a certain point, as a test I was trying to set and retrieve data on element 0 of the cluster.. - there is no python example for this but there are both vb and jscript examples which I have followed.
this is how I am assigning to the UserDataMap Item:
binarySnapshot = uTemplate.BinaryData uDataMap.Item(0).Value = binarySnapshot
uTemplate here is a cluster property created with 'Custom_parameter_list' - and parameters added the same way as it is done in the docs (as far as I can see... (I've tried using AddParameter() and AddParameter3() but this doesn't make any difference)).
This all seems to be going well because after the assignment, Item(0).IsEmpty() changes to False and ItemSize changes to 40 (which seems correct for the 5 doubles that I am storing.. (8 bytes each))
the problem is when I try to read the data out again.. in the example in the docs they simply copy ItemValue(n) to the BinaryData member in the template.. then the values can be read out through the template.
The line that tries to copy into BinaryData in my script makes it fail with an 'Unexpected Failure' COM error. The line that is causing the problem is:
uDataMap.Template.BinaryData = uDataMap.ItemValue(0)
I don't know why this doesn't work.. it's pretty much straight from the docs. this is the output of my script so far (including the error):
#1 items selected. #item: 0 in selection is a:Cluster called: defaultCluster. #defaultCluster is a Cluster.. adding Custom parameter list... #there are: 1033 components to set data on. #the binary size of data on element 0 is: 0. #distressValue: 0.01 #uDataMap.Type = UserDataMap
#before assignment: dataItem.IsEmpty() = True #before assignment: dataItem.Size() = 0 #after assignment: dataItem.IsEmpty() = False #after assignment: dataItem.Size() = 40 #after assignment: uDataMap.ItemSize(0) = 40
#ERROR : 2006 - Traceback (most recent call last): # File "<Script Block >", line 51, in addUserDataMap_Execute # addUserDataMap() # File "<Script Block >", line 174, in addUserDataMap # uDataMap.Template.BinaryData = uDataMap.ItemValue(0) # File "/usr/Softimage/XSI_4.2/Application/bin/win32com/client/dynamic.py", line 527, in __setattr__ # self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) #COM Error: Unexpected failure. - [line 526] #ERROR : OLE error 0x80020101 #ERROR : Traceback (most recent call last): # File "<Script Block >", line 1, in ? # Application.addUserDataMap() # File "<COMObject Application>", line 2, in addUserDataMap #COM Error: Exception occurred. # (0x80020009) - [line 2]
any help with this would be very much appreciated :) thanks dan
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|