I’ve made a faster version of samples converting to components. It’s generally 30 times faster then the older version was.
Check it here:
ConvertSamples.xsiaddon (corrected link)
I’ve made a faster version of samples converting to components. It’s generally 30 times faster then the older version was.
Check it here:
ConvertSamples.xsiaddon (corrected link)
// AlignToElement
// Re-writen in JScript
// Daniel Harjanto : June 26, 06
// version : 0.1
//
// Based on : pv_alignobjectonelement.vbs by Patrick Vier
//
// Description:
// Align object or model to selected element (polygons, edges, vertices)
//
// Usage:
// 1. Select the element where the object will be align.
// 2. Run the script
// 3. Pick the object
// Object will be moved to selected element.
//
// Limitation:
// 1. Object to align must be point in Y+ direction (0, 1, 0)
// Y Axis will be align with the normal of the element.
//
// Bugs:
// 1.
//
// Get user selection, either it's component or object
var oSel = selection(0);
// Use Transient Reference Plane for helper.
SetTransientReferencePlane(oSel);
var rtn = PickElement("object", "Pick Object to align", "Pick Object to align", oObj, button, 0);
var element = rtn.Value("PickedElement");
var button = rtn.Value("ButtonPressed");
var modifier = rtn.Value("ModifierPressed");
if ( button != 0 )
{
//user pick something
var oObj = element;
// Get translation and rotation data of the Transient Reference Plane
px=getvalue ("RefPlanes.Transform.posx");
py=getvalue ("RefPlanes.Transform.posy");
pz=getvalue ("RefPlanes.Transform.posz");
rx=getvalue ("RefPlanes.Transform.rotx");
ry=getvalue ("RefPlanes.Transform.roty");
rz=getvalue ("RefPlanes.Transform.rotz");
// Set the Global transform of object to align with the Reference Plane
var oObjTrans = oObj.Kinematics.Global.Transform;
// set the translation
var newPos = XSIMath.CreateVector3();
newPos.Set(px, py, pz);
oObjTrans.SetTranslation(newPos);
// set the rotation
var newRot = XSIMath.CreateVector3();
newRot.set(XSIMath.DegreesToRadians(rx),
XSIMath.DegreesToRadians(ry),
XSIMath.DegreesToRadians(rz));
oObjTrans.SetRotationFromXYZAngles(newRot);
oObj.Kinematics.Global.Transform = oObjTrans;
}
Nice scripts, I learned a lot by taking a look at them. I’m DL’ing XSI demo now, is there anything that Foundation won’t give access to when you’re scripting? I am going to attempt to port one of my Mels to XSI.
I’m pretty sure that you can do everything in FND, except create scripted operators. You can run SCOPs that have already been created, but you can’t create new ones.
/*-
WFM dvd tools::topo draw prototype/test
REQUIRED : 1) your background mesh must be named "BG_Mesh"
2) an edge selection on the mesh you want to extrude.
3) Face snapping enabled
INSTALLATION :
err...are you sure ?
Drop the script onto a toolbar,
choose external script file,
name it (what will show on the button),
name the command,
make sure you are saving it to a wg or userDir,
bind the bugger to a hotkey.
WARNING : SetupClosestLocationQueries can be slow on heavy meshes. either,
change the query to siClosestVertexOrKnot or just load a lower res mesh for the bg.
As this was just a simple prototype for the openGL version, i didn't bother
with any optimisation (om instead of commands).
I just wanted to get something working - for a given value of the word 'working' :D
Jon Swindells
squid@3d-palace.com
-*/
/*- Deal with the background mesh first -*/
var oRoot = Application.ActiveSceneRoot;
var bgMesh = oRoot.FindChildren("BG_Mesh")(0); // just get the 1st one found.
if(bgMesh)
main()
function main()
{
var edges = checkSel();
if(!edges)
{
logmessage("need edges selected!", siWarning)
return false
}
var bgMeshTrans = bgMesh.Kinematics.Local.Transform
var bgGeom = bgMesh.ActivePrimitive.Geometry;
bgGeom.SetupClosestLocationQueries(siClosestSurface,bgMeshTrans);
var l_cancel = false;
while(!l_cancel)
{
rtn = pickposition("Hello", "Mum", null, null, null, null)
edges = checkSel(); // refreshes the selection
if(!edges)
l_cancel = true;
switch(rtn("ButtonPressed"))
{
case 0 :
l_cancel = true;
break;
case 1 :
// small animals were sacrificed
DuplicateMeshComponent(edges, siPersistentOperation,
null, null, null, null, null, null, null, null, null, null, null, null, null);
Translate(null,rtn("PosX"), rtn("PosY") , rtn("PosZ") ,
siAbsolute, siView, siObj, siXYZ, true, null, null,
null, null, null, null, null, null, 0, null);
// selection has changed
var newEdge = Application.Selection(0)
movePtsToSurface(newEdge)
break;
default :
break
}
}
}
function checkSel()
{
var sel = Application.Selection;
if(sel.Count && sel(0).Type == "edgeSubComponent")
{
return sel(0);
}
else
return false
}
function movePtsToSurface(e)
{
var bgGeom = bgMesh.ActivePrimitive.Geometry;
var bgMeshTrans = bgMesh.Kinematics.Local.Transform
var oSub = e.Subcomponent;
var cEdge = oSub.ComponentCollection;
var oPar = oSub.Parent3DObject;
var oParTrans = oPar.Kinematics.Local.Transform
var oGeo = oPar.ActivePrimitive.Geometry;
var vArray = new Array;
// many loopage
var oEnum = new Enumerator( cEdge );
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var edge = oEnum.item();
var pts = edge.Points
vArray[pts(0).index] = pts(0); // hacky way of removing duplicate verts
vArray[pts(1).index] = pts(1);
}
for(v in vArray)
{
var vec = oGeo.Points(v).Position
var objPos = XSIMath.MapObjectPositionToObjectSpace(oParTrans,bgMeshTrans, vec)
var ClosestPointLocator = bgGeom.GetClosestLocations( [objPos.x, objPos.y, objPos.z] );
var pos = bgGeom.EvaluatePositions(ClosestPointLocator).toArray();
var tmpVec = XSIMath.CreateVector3(pos[0], pos[1], pos[2] )
var wVec = XSIMath.MapObjectPositionToWorldSpace( bgMeshTrans, tmpVec)
Translate(vArray[v], wVec.x, wVec.y, wVec.z, siAbsolute, siViewCOG, siObj, siXYZ,
true, null, null, null, null, null, null, null, null, 0, null);
}
}
TopoDraw type script. its’ very much a prototype 
high res mesh should be named ‘BG_Mesh’
put face snapping on , draw a poly in your scene (preferably on the bg mesh)
select an edge then run the script.
/edit
if you get errors :
bgGeom.SetupClosestLocationQueries(siClosestSurface,bgMeshTrans); <-- bb tags mess with your code
I’m new to this stuff. So this may come off as stupid … but how do I install this file ?
It is an .XML document.
When I change the file name to .xsiaddonn , the name changes, but the file remains an .XML
I really could use this plug in, but have just been to embarrased to post.
Thanks for posting it to us all Jankin !
( Was the file meant to have an .XML extention ? If so how do I use it ? )
Thanks
This is a similar script to “Prune weights” in Maya.
install the plugin, Select one or more envelopes, and run the script from the animation module: ENVELOPE>CLEAN_WEIGHTS
the script will remove deformers who has zero effect on the envelope.
This is very useful after using GATOR to transfer weights between geometries.
cheers,
Am I not supposed to ask questions on this thread ? ( Post " plugins only " type of thing ? )
( Didn’t see anything like that in the first post. )
I’d really like to be able to use the ‘XSI Guides’ plug in if anyone knows how to install it.
Thanks !
I believe the .xsiaddon format is xml.
Try these links:
http://softimage.wiki.avid.com/sdkdocs/cus_addons_InstallingandUninstallingAddons.htm
http://softimage.wiki.avid.com/index.php/Addons_(XSISDK)
http://softimage.wiki.avid.com/sdkdocs/bt495791.htm
Tony, thanks for the feedback.
I managed to figure out what I was doing wrong.
When I was saving the file at first, it was corrupted.
I re-opened the file in a text editor and it saved fine.
Thanks !
( EDIT : It’s installed, but I can’t get it to work. Anyone else care to test this one ?
Using V 5.11.2006.0529 at the moment )
Since RC_Tools no longer work in XSI v6, Reinhard very kindly provided what he’s using now.
Usage: Select Poly(s), run script to select surrounding edges.
SelectFilter("Polygon");
InvertSelection("Polygon");
SelectAdjacent(null, "Edge");
S_tmp = Selection(0);
SelectAllUsingFilter("Border_Edge");
if(S_tmp) AddToSelection(S_tmp);
InvertSelection("Edge");
S_inner = Selection(0);
SelectFilter("Polygon");
InvertSelection("Polygon");
SelectAdjacent(null, "Edge");
if(S_inner) RemoveFromSelection(S_inner);
And here’s Reinhard’s new cap holes script
SelectFilter siObjectFilter
objFullName = Selection(0).FullName
SelectFilter siPointFilter
On Error Resume Next
ptSelection_bak = Selection(0).SubComponent
SelectAllUsingFilter
SelectFilter siEdgeFilter
DuplicateMeshComponent
ApplyTopoOp "Collapse"
SelectFilter siPointFilter
InvertSelection
nPts = Selection(0).SubComponent.ComponentCollection.Count
SelectAdjacent null, "Polygon", false
SelectFilter siPointFilter
ApplyTopoOp "DissolveComponent"
If ptSelection_bak Then
SelectGeometryComponents ptSelection_bak
Else
DeselectAll
End If
SelectFilter siEdgeFilter
LogMessage "Done. " & nPts & " polygons created (and selected)"
Mostly useless plugin attached 
xsi v6 only i’m afraid.
it toggles your xsi window to a ‘fullscreen’ effect (told you it was mostly useless
)
untested for the most part but i’ve been using this in various incarnations for ages without a problem.
Enjoy
this set of tools will make it easier to look through that long list of spot lights in your scene… be forwarned this is done all in python, as are most of my tools…
follow the link and all will be explained. please forward any comments and bugs to the contact info on the website, with the script in the subject line. enjoy!

point = Selection(0).subcomponent.componentCollection;
obj = selection(0).name;
if (point.count==2) {
SelectAdjacent(null, "Polygon", false);
polys = Selection(0).subcomponent.componentCollection;
for (var i=0;i<polys.count;i++){
a=findEdge(point(1).index,polys.item(i).edges);
if (a!=-1) edge=a;
}
if (edge>-1) {
AddEdge(obj+".pnt["+point(0).index+"];"+obj+".edge["+edge+"];",0, siPersistentOperation, null, null);
}
SetPointSelectionFilter();
}
function findEdge(p,e){
for (var i=0;i<e.count;i++){
if (p==e(i).points(0).index) return e(i).index;
}
return -1;
}
Select 2 points (e.g. in a n-gon), run the script and they will get connected with an edge
Hi im wondering if there is a script for xsi or maybe its already inplanted in xsi.anyway the script works like this if u select 4 faces it makes a perfect circle so u can extrude a perfect hole without spending time to tweak. i saw this script for modo so im wondering if there anything like this for xsi. here is a better description on how it works (copyed from the script in modo)
#This script is for taking a POLY(s) or EDGELOOP(s) and moving the vertices so they form a perfect circle.
#This script was made because I often STENCIL or KNIFE a CIRCLE onto a mesh, and waste a lot of time tweaking the verts to try to get it perfectly round…
#-If you have MULTIPLE POLYGONS selected, it’ll only pay attention to the BORDER VERTS.
#-If you have VERTS selected it will convert the selection to EDGES, so if converting the selection to edges didn’t result in EDGELOOPS, then this script won’t work
#-(7-18-05) bugfix: the script will work If you’re using centimeters, millimeters, etc now.
#(2-2-06) MODO2 FIX and the script now works in symmetry!
hi :
im moving from max script and maya mel .
in xsi script preference , im have not found out some topics about UI setting which like in max : rollout . mel: window . and the script preference looks only arranged by ABC… .i dont know xsi script well , so it is hard to me to get what i want .
basicly : when i do some script in max or maya .
first is to make a interface for the users . in max , i will make a rollout , and place some button , spinner … for the user to input . mel too . and then make functions for this items . when press button , do something …etc .
i search “button” in xsi script . and found some info about xsi sdk , do i have to make all these steps in sdk ? or have to use c++ api ?
thanks for show me a way
you need to look up… “Custom Properties”’ in Help>SDK Guides
you will find a lot of information on making UIs
steven