something wrong in this code ?  if yes please help.

something wrong in this code ?  if yes please help.

DOODLEANU
Enthusiast Enthusiast
545 Views
10 Replies
Message 1 of 11

something wrong in this code ?  if yes please help.

DOODLEANU
Enthusiast
Enthusiast

something wrong in this code ?  if yes please help.

 

(defun c:GLASS ()
  ;; Unfreeze all layers
  (command "._-layer" "thaw" "GLASSWALL" "")
  (command "._-layer" "thaw" "BLOCKWALL" "")
  (command "._-layer" "thaw" "GYPSUMWALL" "")

  ;; Set "GLASS" as current layer
  (command "._-layer" "make" "GLASSWALL" "")

  ;; Freeze other two layers
  (command "._-layer" "freeze" "BLOCKWALL" "")
  (command "._-layer" "freeze" "GYPSUMWALL" "")
 ;; Select all Polylines feom the GLASSWALL layer *****NOT WORKING***
  (setq ss (ssget "X" (list (cons 8 "GLASSWALL") (cons 0 "POLYLINE"))))

  (princ "\nGLASS is current, others frozenand all polylines are selected.")
  (princ)
)

 

0 Likes
Accepted solutions (2)
546 Views
10 Replies
Replies (10)
Message 2 of 11

cadffm
Consultant
Consultant
Accepted solution

Hi,

 

nothing wrong, works technically perfect.

 

You forgot to say what you expect! I guess you want to create a grip&pickset, so polylines are selected?

 

(princ "\nGLASS is current, others frozenand all polylines are selected.")

 

 

 

SSGET created a selectionset ONLY,

you can access this selectionset by object selection method PREVIOUS (P)

 

Solution for your Lisp: Add a SSSETFIRST statement!

https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-4076CD9D-1C66-4C73-ACC0-3A6CD0B0D2D8

 

 

(defun c:GLASS ()

(command "_.-LAYER" "_n" "GLASSWALL,BLOCKWALL,GYPSUMWALL" "")
  
  ;; Unfreeze all layers
  (command "._-layer" "thaw" "GLASSWALL" "")
  (command "._-layer" "thaw" "BLOCKWALL" "")
  (command "._-layer" "thaw" "GYPSUMWALL" "")

  ;; Set "GLASS" as current layer
  (command "._-layer" "make" "GLASSWALL" "")

  ;; Freeze other two layers
  (command "._-layer" "freeze" "BLOCKWALL" "")
  (command "._-layer" "freeze" "GYPSUMWALL" "")
 ;; Select all Polylines feom the GLASSWALL layer
  (if (setq ss (ssget "X" (list (cons 8 "GLASSWALL") (cons 0 "POLYLINE")))) ;Alternative for all Plines: (cons 0 "*POLYLINE"))))
      (progn
        (princ "\nGLASS is current, others frozenand all polylines are selected.")
	(sssetfirst nil ss)
	(command "_.regen")
      )
      (princ "\nNothing selected")
  )
  (princ)
)

 

 
 

 

 

Sebastian

0 Likes
Message 3 of 11

DOODLEANU
Enthusiast
Enthusiast

I was expecting all polylines from the "GLASSWALL" layer to be selected after all the layer modifications.  will that be possible?

0 Likes
Message 4 of 11

ВeekeeCZ
Consultant
Consultant
Accepted solution

Just in case you don't know...

'(0 . "LWPOLYLINE")

 

"regular" polyline is "LWPOLYLINE"

3D polyline is "POLYLINE"

 

So... as suggested by @cadffm  *POLYLINE would cover both types.

Message 5 of 11

ВeekeeCZ
Consultant
Consultant

And if I may suggest...

  (command "._-layer" "thaw" "GLASSWALL" "")
  (command "._-layer" "thaw" "BLOCKWALL" "")
  (command "._-layer" "thaw" "GYPSUMWALL" "")

 

Better wrap those into single command...  

(command "layer" "thaw" "glasswall,blockwall,gypsumwall" "") ... that way it would be 1 step for UNDO or LAYERP...

 

Also can add

(command "layer" "thaw" "glasswall,blockwall,gypsumwall" "make" "glasswall" "")

Message 6 of 11

Moshe-A
Mentor
Mentor

@DOODLEANU ,

 

the regen command cancels the effect of (sssetfirst), remove it

0 Likes
Message 7 of 11

DOODLEANU
Enthusiast
Enthusiast

Got it, thank you so much for the support.

0 Likes
Message 8 of 11

cadffm
Consultant
Consultant

Hi,

which version you are taliing about?

That shouldn't be.

 

( I NEED this regen in my test version/PC/Graphicscard) , or I have to click in editor window, to show highlight&grips)

 

 

Sebastian

0 Likes
Message 9 of 11

ВeekeeCZ
Consultant
Consultant

@cadffm wrote:

( I NEED this regen in my test version/PC/Graphicscard) , or I have to click in editor window, to show highlight&grips)

 

Just for the record... a quick research.

 

it's (command "layer" "freeze" ...) that cause the trouble. Not thaw or make, just freeze. I've tried various methods less disturbing to redraw/active screen but nothing else works but regen.

So if layer must be frozen this way, it requires regen to show grips by (sssetfirst). But it could be done before (sssetfirst) so it's a bit more efficient since grips don't have to be redrawn.

 

Ultimate solution is to use other freezing methods - entmode, activex method or setpropertyvalue... all works without need to regen.

0 Likes
Message 10 of 11

cadffm
Consultant
Consultant

He BeekeeCZ,

 

"So if layer must be frozen this way, it requires regen. "

1. No!?, Command Layer-freeze works without a manually/additional regen command, like ON/OFF too.

    (command "_.-layer" "_freeze" "Test" "") works directly

 

2. I read Moshe-A comment different. He said highlight&grips disappering, because of my following REGEN command.

     That would be new for me, so I ask about the program version.

-

On the contrary, I absolutely need a refresh so that sssetfirst is immediately visible on the screen.

 

Your opinion?

Sebastian

0 Likes
Message 11 of 11

ВeekeeCZ
Consultant
Consultant

I should have add that it's in context of sssetfirst usage. So I'm with you.