How to get X,Y,Z coordinate values from a point?

107 Views Asked by At

I have N number (user input) of point data. each point have X, Y, Z coordinate. I want to use this in a tool automation code. in the below code user is giving number of points in 1st line. the number of points are stored in set s1 after that it extract the X, Y, Z coords value in s1x, s1y and s1z set this sets then called in createplane command (ignore $px $py $pz)

Now I want to call each point and extract the x, y, z coords value and place it in createplane command untill the number of user input points.

Because of tool restrictions n policy can't share the proper tool code. This is a rough code or you can say idea.

createpanel points 1 "Select points"
set s1 [mark points 1]
foreach {N} $s1 {
    set s1x [ getentityvalue $s1 "globalx" 0 ]
    set s1y [ getentityvalue $s1 "globaly" 0 ]
    set s1z [ getentityvalue $s1 "globalz" 0 ]
    createplane 1 $px $py $pz $s1x $s1y $s1z
    createvector 1 $px $py $pz
}

if you have any idea to solve this problem please help. thanks in advance.

1

There are 1 best solutions below

0
Donal Fellows On

Broadly speaking, to update the points of a collection of entities, you'd do:

foreach item [getEntityCollectionAsList] {
    set coords [getNewCoordinatesFor $item]
    setCoordinatesOf $item $coords
}

That's a very high-level picture! The entity collection could be in a database or on a screen or in a simulation or any number of other things. The new coordinates could be obtained from many different places (including by directly asking the user, though that would become annoying for large numbers of points). It also doesn't say what the format of the coordinates themselves are (or how many points each item has) or how exactly the new coordinates are set. "All" you have to do is provide implementations of getEntityCollectionAsList, getNewCoordinatesFor, and setCoordinatesOf, probably changing the names in the process (and maybe adding other arguments as required); that could be easy or difficult.

Without knowing where the data is coming from or going to, it's hard to say much specific. The above pattern is very likely to feature in some form, but there's a vast amount of variation still possible.