How to stop drawing lines drawn using gw.Polyline

Hello,

I am drawing some visualization lines using gw.Polyline in maxscript.
How can I toggle visibility of those Polylines?

Even if it means clearing out everything and redrawing them, its fine.
I tried gw.clearscreen but didn't seem to work.

Thanks in advance

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vishangshah's picture

Thanks for reply. Below is

Thanks for reply.
Below is the code I am using from maxscript help page.

unregisterRedrawViewsCallback GW_displayObjectNames
fn GW_displayObjectNames =
(
  gw.setTransform (matrix3 1)
  for o in objects where not o.isHiddenInVpt do
    gw.text o.pos (o as string) color:yellow
  gw.enlargeUpdateRect #whole  
)
registerRedrawViewsCallback GW_displayObjectNames

I tried to run unregisterRedrawViewsCallback "functionname".
But that didn't help. Even resetting doesn't disable it.
Only restarting works or deleting scene object (which will result in an error due to registered calls).

miauu's picture

.

This works:

(
	global GW_displayObjectNames
	unregisterRedrawViewsCallback GW_displayObjectNames
	fn GW_displayObjectNames =
	(
	  gw.setTransform (matrix3 1)
	  for o in objects where not o.isHiddenInVpt do
		gw.text o.pos (o as string) color:yellow
	  gw.enlargeUpdateRect #whole  
	)
	registerRedrawViewsCallback GW_displayObjectNames
)
--	"to stop the drawing uncomment and execute next line only"
-- unregisterRedrawViewsCallback GW_displayObjectNames
fajar's picture

if drawing line must be

if drawing line must be registered then stop drawing must be unregistered those function ..

let say you have

fn drawLine =
(
-- draw some line here
)
---to draw in screen you must use 
 
RegisterRedrawViewsCallback drawLine 

to stop it you must use

unRegisterRedrawViewsCallback drawLine 
miauu's picture

.

To be sure that the drawLine will be unregistered correctly declare it as a global variable first.

miauu's picture

.

Post your code.

pixamoon's picture

`

is it with registerRedrawViewsCallback ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.