need to extrude all polylines on the same layer

need to extrude all polylines on the same layer

Anonymous
Not applicable
477 Views
1 Reply
Message 1 of 2

need to extrude all polylines on the same layer

Anonymous
Not applicable

Hi all

 

I have drawing that consists of lets say 20 different layers and multiple polygons.

 

I am trying to write a script that does this:

 

1-  make layer L1 the active layer (isolate, etc)

2- select everything on layer L1

3- extrude all objects to the height of 1um

4- make layer L2 the active layer (isolate, etc)

2- select everything on layer L2

3- extrude all objects on layer L2 to the height of 2um

and so on

 

 

I know i can do it with Qselect or by using the filter pop-up toolbox. But how would you do it in a script?

 

thanks

 

Capture.JPG

0 Likes
478 Views
1 Reply
Reply (1)
Message 2 of 2

hmsilva
Mentor
Mentor

@Anonymous wrote:

Hi all

 

I have drawing that consists of lets say 20 different layers and multiple polygons.

 

I am trying to write a script that does this:

 

1-  make layer L1 the active layer (isolate, etc)

2- select everything on layer L1

3- extrude all objects to the height of 1um

4- make layer L2 the active layer (isolate, etc)

2- select everything on layer L2

3- extrude all objects on layer L2 to the height of 2um

and so on

 ...

 

I know i can do it with Qselect or by using the filter pop-up toolbox. But how would you do it in a script?

 

thanks


Hello ehsanshahos and welcome to the Autodesk Community!

 

By 'in a script' do you mean a '*.scr' file or a '*.lsp' file?

If a '*.lsp' file, perhaps something like this will do the trick.

Quick and dirty and untested...

 

(vl-load-com)
(defun c:demo (/ laylst ss tblname)
   (while (setq tblname (tblnext "Layer" (null tblname)))
      (setq laylst (cons (strcase (cdr (assoc 2 tblname))) laylst))
   )
   (command "_.Layer" "_T" "*" "_ON" "*" "_U" "*" "")
   (foreach lay laylst
      (if (and (wcmatch lay "L#*")
               (setq ss (ssget "_X" (list '(0 . "LWPOLYLINE") (cons 8 lay) (cons 410 (getvar 'ctab)) '(-4 . "&=") '(70 . 1))))
          )
         (command "_.Layer" "_S" lay "" "_.extrude" ss "" (read (vl-string-subst "" "L" lay)))
      )
   )
   (princ)
)

 

Hope this helps,
Henrique

EESignature

0 Likes