Manipulate a point in x, y, z Topic is solved

Discussions concerning programming of SOFTIMAGE©
Posts: 12
Joined: 16 Nov 2012, 12:28

Manipulate a point in x, y, z

Post by starcow » 02 Nov 2017, 10:35

Hi guys
Quick question:
I'm looking for a way to manipulate a vertex (or a array of vertices) directly with a script.
Because I have to round every value from each point (x, y, z) before I export the mesh as a obj-file.

How can I access the x, y, and z coordinates of a vertex?
And how can i walk through the whole arry?

I tried this but it doesn't work:

Code: Select all

 mesh-wall.pnt[i].x = Round(mesh-wall.pnt[i].x, 4)
Can someone help me out?

User avatar
Posts: 389
Joined: 28 Sep 2011, 10:33

Re: Manipulate a point in x, y, z

Post by myara » 02 Nov 2017, 11:14

It is possible to do that by getting the PositionArray, iterating, rounding and sending it back to the polygon.

Your object will need to be a frozen object without history.
You will have to export as an obj with local positions to maintain these values.

Code: Select all

xsi = Application

# Round Decimals Value
dec = 4

# Your Selection
obj = xsi.Selection(0)

# Freeze Selection because Softimage wont let you manipulate points positions if the object isn't frozen.

# Access Points, and get PositionArray Tuple
geo = obj.ActivePrimitive.Geometry
points = geo.Points
posTup = points.PositionArray

# The position tuple posTup will give you a tuple with 3 multi-dimensional elements. One for each axis.
# posTup[0] will be all the X positions of all the points, and so on.

# Create a list version of the posTup to manipulate it
newPos = [ list(posTup[0]), list(posTup[1]), list(posTup[2]) ]

# Iterate, round weights of Tuple and store it in the new List
for i in range(points.Count):
    newPos[0][i] = round( posTup[0][i], dec)
    newPos[1][i] = round( posTup[1][i], dec)
    newPos[2][i] = round( posTup[2][i], dec)

# Send new position back
points.PositionArray = newPos
Character Modeler | Softimage Generalist (sort of)

Posts: 12
Joined: 16 Nov 2012, 12:28

Re: Manipulate a point in x, y, z

Post by starcow » 03 Nov 2017, 16:46

Great! Thank you very much!
This helps a lot :)


Bravlin Pechatnik
Posts: 18
Joined: 03 Nov 2013, 07:02

Re: Manipulate a point in x, y, z

Post by Bravlin Pechatnik » 02 Jan 2018, 11:24

That is one of a greatest "pain in the ass" problems of XSI topology plugins dev.
You can change geo only through Operators or ICE nodes. But even so if you add new verts you would lose your UVs. So if you want to write something more interactive
you would deal with alot of bumps and ugly ways to share calculated information and variables between plugin elements (Operators, commands, Tools) .
You would also got problem with order of Operator and Tool callbacks and geometry differences.
Also if you want to keep your UVs you would deal with native XSI Operators.

So if you do not want to freez you modelling history
Write your own CustomOperator and use GetPositionArray PutPositionArray.
But if you want add new verts then in any way except using native SplitEdge operators you would loose UVs.
All sdk information about Clusters that expands to all verts etc is bullshit. They don't.

User avatar
Posts: 983
Joined: 19 Jun 2012, 21:59

Re: Manipulate a point in x, y, z

Post by FXDude » 03 Jan 2018, 21:10

Ya UV preservation/management with topo modifications were always a pain,
I think mostly due to how low level most of the factory topo tools are.

It seems Eric Mootz made backflips to make UVs work across most of his topo changing tools.

Which are now available BTW, and are what I personally wished factory nodes would have included.
(being like the regular (high level) mesh operators, but in ICE)