View Full Version : XSI VB Question

04 April 2008, 04:36 PM
Hi Folks,

I have a VB question for XSI. Before I start let me first clearify what I need it for. What I want to do is create a script where upon selection of a CTRL_Obj ie. "LLeg_CTRL" I want the Custom Parameter Set I created for it to appear Automatically without having to go into the Explore to find it.

Here is what I have come up with so far.

if SelectObj = "Man.LLeg_CTRL" then
InspectObj "Man.LFoot_CTRL"
end if

Unfortunately this is not working properly yet. What I want to do is have the word Man in the first line to be unrelevant. And later on have a substitute such as N for the second line, where n = to the last SelectObj. If anyone can help me I would appreciate it, I am not very good at Scripting unfortunately.


04 April 2008, 04:06 AM
You would probably need to look into the OnSelectionChange event if you want this to run when a selection is made.

I don't know VB, but this is how I would probably inspect a selection's custom parameter set in Python:

from win32com.client import constants

oSel = Application.Selection
strToMatch = '_CTRL'

# See if there is a selection and if the first item's name has a substring
# that matches the value in the variable strToMatch
if oSel.Count and oSel[0].Name.count(strToMatch):

# Try to store the selection's first custom parameter set in a variable
oCPS = oSel[0].Properties.Find(constants.siCustomParamSet)

# If we actually have a custom parameter set...
if oCPS:

# ...inspect it

Not sure how you would inspect the last selection's custom parameter set... unless you stored it in a global variable or something. What is the relationship of "Man.LFoot_CTRL" to "Man.LLeg_CTRL"? If there is a known parent/child relationship you could access the custom parameter set that way.

Hope that helps.

CGTalk Moderation
04 April 2008, 04:06 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.