#wrong object name?
19-Apr-95 07:50:03
Sb: #165458-#wrong object name?
Fm: Larry Minton 74010,3076
To: Tim c Branan 76360,540
Tim,
The problem is that you are never actually storing the selected object names in
array Selected_Objects$. Also, in your second for/next loop you were
offsetting your counter by -1. Not sure why.
I did some minor cleaning up of your script, mainly just to make things more
visible. Look at the first for/next loop..
Unless another portion of your routine needs the names of the selected objects,
I wouldn't even store them in your routine. See the commented lines in the
second for/next loop.
I left the call in for SortObjTag, but with the number of objects you are
dealing with, I would highly, strongly, adamently recommend not making this
call. It's very slow, and it doesn't seem like you really need the names in
sorted order.
LAM
*****************************************************************************
DefPosition ObjectPosition DIM Selected_Objects$(3000,32)
Ext$(0)= "XYZ" Selectfile "Select XYZ node file", "", "" If RC < 1 Then End
;open a file of x,y,z data Open FileName$, INPUT, #50
PWindow 25, 40, 40, 5
;initialize variables for call to PickObjectsExp gosub InitObjTag : gosub
SortObjTag
;old line was: Filter=NT_TAGSET+NT_OBJECT : gosub ObjTagAll ;If you want all
objects, don't worry about the tagging ;new line is: Filter=NT_OBJECT gosub
PickObjectsExp : if RC <1 then end total_objects_selected = RC
;the following for/next loop can be deleted if the next for/next loop is
;modified as documented in the comments. Also delete the dimensioning of
;Selected_Objects$.
;all of the selected objects get stuffed into the array called
;Selected_Objects$… for i=1 to total_objects_selected
NodeNumber=i : gosub GetSelectedObject
Selected_Objects$(i)=NodeName$ next i
ObjectPosition.time = 0 ObjectPosition.tens = 25 ObjectPosition.cont
= 25 ObjectPosition.bias = 25 ObjectPosition.easeTo = 0
ObjectPosition.easeFrom = 0
for i = 1 to total_objects_selected step 1
input #50, x,y,z
' when you hit an end of file, numeric variable default to 0, while
' string variable default to NULL, ie ""
if x = 0 and y = 0 and z = 0 then i = 10000: goto next_i
ObjectPosition.x = x
ObjectPosition.y = y
ObjectPosition.z = z
CreateKey Selected_Objects$(i), ObjectPosition ;if you want to get rid of
first for/next loop, replace the above line with: ; NodeNumber=i : gosub
GetSelectedObject ; CreateKey NodeName$, ObjectPosition
@next_i next i
end
****************************************************************************