Thorn444
10-05-2009, 12:22 PM
Hello everybody
I got today another one small exercise for that who would like explain to me what I am doing wrong that my script is slow again J This Is just a test for gw. command and should have draw vertex number for selected spline on screen. Yes I know it is exactly same how SHOW VERTEX NUMBERS in line but the point is why my screen draw is not so smooth and fast. Is it because I do something generally wrong or because I can’t have better feedback from gw. command when I am updating whole screen? Thanks for your explanation and suggestion how it write better.
global DrawTest
unregisterRedrawViewsCallback DrawTest
fn DrawTest =
(
gw.setTransform(Matrix3 1)
local p3TextPos = [0,0,0]
SplineSet = $
if (selection.count == 1) and ((isKindof SplineSet splineshape == true) or (isKindOf SplineSet line == true)) do
(
for i = 1 to numKnots SplineSet do
(
KnotPosition = getKnotPoint SplineSet 1 i
p3TextPos =gw.wTransPoint KnotPosition
--print p3TextPos
KnotNumber = i as string
--Print KnotNumber
gw.wText p3TextPos KnotNumber color:yellow
)
)
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
registerRedrawViewsCallback DrawTest
Don't forget take this for unregister
unregisterRedrawViewsCallback DrawTest
I got today another one small exercise for that who would like explain to me what I am doing wrong that my script is slow again J This Is just a test for gw. command and should have draw vertex number for selected spline on screen. Yes I know it is exactly same how SHOW VERTEX NUMBERS in line but the point is why my screen draw is not so smooth and fast. Is it because I do something generally wrong or because I can’t have better feedback from gw. command when I am updating whole screen? Thanks for your explanation and suggestion how it write better.
global DrawTest
unregisterRedrawViewsCallback DrawTest
fn DrawTest =
(
gw.setTransform(Matrix3 1)
local p3TextPos = [0,0,0]
SplineSet = $
if (selection.count == 1) and ((isKindof SplineSet splineshape == true) or (isKindOf SplineSet line == true)) do
(
for i = 1 to numKnots SplineSet do
(
KnotPosition = getKnotPoint SplineSet 1 i
p3TextPos =gw.wTransPoint KnotPosition
--print p3TextPos
KnotNumber = i as string
--Print KnotNumber
gw.wText p3TextPos KnotNumber color:yellow
)
)
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
registerRedrawViewsCallback DrawTest
Don't forget take this for unregister
unregisterRedrawViewsCallback DrawTest
