displaced
04-29-2008, 02:53 PM
Hi,
im trying to write a script that will delete polys that are within a pre determined distance of each other
so far i can get the locations of the polys into an array and then work out the distance between the polys.
but im having trouble with the latter array.
I realized that i would have to work out the distance between every poly in the object and not just the next one along as there is no saying that the polys will be arranged in a sequential order, this is where i started to hit probelms.
so.....
i need to be able to work out the location of every poly and then calculate the distance that poly is from every other poly and the select polys that are below or equal to a pre defined value.
so here is what i have so far.
macroScript deletenearbypolys
(
Global distancearray = #()
Global facearray = #()
Global facecount
Global distancevalue = 0
Global selectionface = #()
Global Facenum
rollout deletepolys "Delete Polys" width:227 height:161
(
-- ROLLOUT FUNCTIONS --------------------------------------------
bitmap bmp1 "Bitmap" pos:[5,6] width:217 height:45
spinner spn_distance "Distance" pos:[33,73] width:156 height:16
groupBox grp1 "" pos:[5,51] width:216 height:102
button dist_select "select" pos:[21,108] width:73 height:29
button dist_delete "delete" pos:[122,108] width:73 height:29
---------------------------------------------------------------------------
--WORKINGS--------------------------------------------------------------
on spn_distance changed spn_amunt do (distancevalue = spn_amunt)
on dist_select pressed do
(
facecount = polyop.getnumfaces $
for f = 1 to facecount do
(
loc = polyop.getFaceCenter $ f
faceNum = f as string
print "face #:" + faceNum
print loc
append faceArray loc
)
print facearray
for f = 1 to facecount do
(
for g = f+1 to facecount do
(append distancearray ( distance facearray[f] facearray[g]))
)
)
)
createDialog deletepolys pos:[100,130] style:#(#style_minimizebox, #style_titlebar, #style_sysmenu)
)
Hope this makes sense
cheers Colin
im trying to write a script that will delete polys that are within a pre determined distance of each other
so far i can get the locations of the polys into an array and then work out the distance between the polys.
but im having trouble with the latter array.
I realized that i would have to work out the distance between every poly in the object and not just the next one along as there is no saying that the polys will be arranged in a sequential order, this is where i started to hit probelms.
so.....
i need to be able to work out the location of every poly and then calculate the distance that poly is from every other poly and the select polys that are below or equal to a pre defined value.
so here is what i have so far.
macroScript deletenearbypolys
(
Global distancearray = #()
Global facearray = #()
Global facecount
Global distancevalue = 0
Global selectionface = #()
Global Facenum
rollout deletepolys "Delete Polys" width:227 height:161
(
-- ROLLOUT FUNCTIONS --------------------------------------------
bitmap bmp1 "Bitmap" pos:[5,6] width:217 height:45
spinner spn_distance "Distance" pos:[33,73] width:156 height:16
groupBox grp1 "" pos:[5,51] width:216 height:102
button dist_select "select" pos:[21,108] width:73 height:29
button dist_delete "delete" pos:[122,108] width:73 height:29
---------------------------------------------------------------------------
--WORKINGS--------------------------------------------------------------
on spn_distance changed spn_amunt do (distancevalue = spn_amunt)
on dist_select pressed do
(
facecount = polyop.getnumfaces $
for f = 1 to facecount do
(
loc = polyop.getFaceCenter $ f
faceNum = f as string
print "face #:" + faceNum
print loc
append faceArray loc
)
print facearray
for f = 1 to facecount do
(
for g = f+1 to facecount do
(append distancearray ( distance facearray[f] facearray[g]))
)
)
)
createDialog deletepolys pos:[100,130] style:#(#style_minimizebox, #style_titlebar, #style_sysmenu)
)
Hope this makes sense
cheers Colin
