View Full Version : Use current selection in a basic script?
Sbowling 02-01-2006, 02:03 AM Hi,
I have a basic set of script I'm tring to make work on the selected object instead of "box". Unfortunately, I can't figure this out on my own and can't find anything that explains how to do this on the internet.
Here's my current script:
ApplyTopoOp "FilterPoints", "box", siUnspecified, siPersistentOperation
ApplyTopoOp "Quadrangulate", "box", siUnspecified, siPersistentOperation
SetValue "box.polymsh.quadrangulateop.polygonanglethreshold", 52.571
SetValue "box.polymsh.quadrangulateop.maxcornerrightangledeviation", 79.701
SetValue "box.polymsh.quadrangulateop.maxalignmentangle", 60
Basically, I need to merge all the points on some imported 3ds objects, then quadrangulate them.
Thanks for any help!
|
|
thorn3d
02-01-2006, 02:11 AM
Hi,
I have a basic set of script I'm tring to make work on the selected object instead of "box". Unfortunately, I can't figure this out on my own and can't find anything that explains how to do this on the internet.
Here's my current script:
ApplyTopoOp "FilterPoints", "box", siUnspecified, siPersistentOperation
ApplyTopoOp "Quadrangulate", "box", siUnspecified, siPersistentOperation
SetValue "box.polymsh.quadrangulateop.polygonanglethreshold", 52.571
SetValue "box.polymsh.quadrangulateop.maxcornerrightangledeviation", 79.701
SetValue "box.polymsh.quadrangulateop.maxalignmentangle", 60
Basically, I need to merge all the points on some imported 3ds objects, then quadrangulate them.
Thanks for any help!
Dont have XSI in front of me... and haven't scripted lately. This could crash and burn (ie not work) ;) but try this:
ApplyTopoOp "FilterPoints"
ApplyTopoOp "Quadrangulate"
SetValue "polymsh.quadrangulateop.polygonanglethreshold", 52.571
SetValue "polymsh.quadrangulateop.maxcornerrightangledeviation", 79.701
SetValue "polymsh.quadrangulateop.maxalignmentangle", 60
If this doesn't work and no one else chimes in, i'll give a go in the morning when i'm back in front of my workstation.
thorn
ThE_JacO
02-01-2006, 02:18 AM
Hi,
I have a basic set of script I'm tring to make work on the selected object instead of "box". Unfortunately, I can't figure this out on my own and can't find anything that explains how to do this on the internet.
Here's my current script:
ApplyTopoOp "FilterPoints", "box", siUnspecified, siPersistentOperation
ApplyTopoOp "Quadrangulate", "box", siUnspecified, siPersistentOperation
SetValue "box.polymsh.quadrangulateop.polygonanglethreshold", 52.571
SetValue "box.polymsh.quadrangulateop.maxcornerrightangledeviation", 79.701
SetValue "box.polymsh.quadrangulateop.maxalignmentangle", 60
Basically, I need to merge all the points on some imported 3ds objects, then quadrangulate them.
Thanks for any help!
the way you're doing it is command based, which is quite a horrible way of doing it :)
but assuming you're not after learning exercises in scripting, but just getting something done, try:
'VBS language
set oSel = Application.Selection
for each oItem in oSel
strObjName = oItem.FullName
ApplyTopoOp "FilterPoints", strObjName, siUnspecified, siPersistentOperation
ApplyTopoOp "Quadrangulate", strObjName, siUnspecified, siPersistentOperation
SetValue strObjName & ".polymsh.quadrangulateop.polygonanglethreshold", 52.571
SetValue strObjName & ".polymsh.quadrangulateop.maxcornerrightangledeviation", 79.701
SetValue strObjName & ".polymsh.quadrangulateop.maxalignmentangle", 60
next
this will run your commands on each object in your selection.
Sbowling
02-01-2006, 02:23 AM
Thanks for the reply thorn.
This part works:
ApplyTopoOp "FilterPoints"
ApplyTopoOp "Quadrangulate"
This part fails:
SetValue "polymsh.quadrangulateop.polygonanglethreshold", 52.571
SetValue "polymsh.quadrangulateop.maxcornerrightangledeviation", 79.701
SetValue "polymsh.quadrangulateop.maxalignmentangle", 60
Sbowling
02-01-2006, 02:30 AM
the way you're doing it is command based, which is quite a horrible way of doing it :)
but assuming you're not after learning exercises in scripting, but just getting something done, try:
<munch>
this will run your commands on each object in your selection.
Thanks ThE_JacO, but this doesn't work when I run it from the script editor.
I get this Error:
'ERROR : Wrong number of arguments or invalid property assignment: 'oSel' - [line 2]
I know the command based method isn't very pretty or elegant, but I have a very basic grasp of VBScript, and I'm fairly inept at any other programming language. :shrug: One day I plan on getting the 3dtutorial videos on scripting, but I'm very short on time right now, so modifying commands is about the only option I have for now.
Thanks for the quick reply (again).
ThE_JacO
02-01-2006, 02:43 AM
sorry, been a while since I last wrote in VBS
it should be set oSel = Application.Selection
that should fix it
Sbowling
02-01-2006, 02:54 AM
Thanks ThE_JacO,
one more tiny error that I was able to resolve on my own was a space in the maxcornerrightangledeviation command. Looks like it was from the wordwrap caused by the giant fonts I somehow used in my initial post.
Thanks again. You guys are great!
Edit: font size issues! How do I get my fonts to not default to giant?
CGTalk Moderation
02-01-2006, 02:54 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.