Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a macro to do selection

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
filapost
635 Views, 3 Replies

Create a macro to do selection

create a command Macro or an autolisp function to select all the dimensions  and put them on a new layer called "dim"

3 REPLIES 3
Message 2 of 4
Kent1Cooper
in reply to: filapost

Welcome to these Forums!  Have you tried Searching for one [always the best first step]?  There is probably something like that here already.

Kent Cooper, AIA
Message 3 of 4
Anonymous
in reply to: filapost

hi There,

 

one way To do This:

 

(ssget) all of your dimensions

(Then Move to Layer)

 

**

 

I do not have Autocad loaded or installed so I can not check This.

I am Totally new to Fusion360. I am still Looking for the LISP Loader

 

but, for what it is worth, check This out.

 

**

 

(defun c:DFX (/ BK LA SS N SSL B C)
(setq LA (getstring "\nEnter Layer Name: To Move Dimensions To: ")
)
(prompt "\nSearching for Dimension(s) ... ")
(if (eq (setq SS (ssget "X" (List (cons 0 "dimensions")))) nil)
(progn
(prompt "\nNo Dimensions found, Please try again.")
(command nil nil nil)
)
(progn
(setq N 0
SSL (sslength SS)
)
(DMFIX)
)
)
(princ)
)

 

(defun DMFIX ()
(prompt (strcat "\nSearching for all Dimensions "))
(while (< N SSL)
(setq B (ssname SS N)
C (entget B)
NEW (cons 8 LA)
OLD (assoc 8 C)
)
(if (/= NEW OLD)
(setq C (subst NEW OLD C))
)
(entmod C)
(setq N (1+ N))
(princ "*")
)
(prompt (strcat "\n<" (itoa SSL) "> Dimensions Moved To LAYER <"
(strcase LA) ">. "))
)

 

**

 

You might want to check the Line That has the (ssget "X") function in it, To make sure how "dimensions" are actually Listed/named in DXF codes.

It might be possible to ADD a Dimension Style (not sure how To do This) so That You can move certain dimensions to a specified Layer instead..

 

**

 

I hope This is helpful

 

**

 

Randy (just add coffee)

2dcd2b3d@gmail.com

Message 4 of 4
filapost
in reply to: Anonymous

Hi 2dcd2b3d

 

Thank you for your time and response!

You were very helpful with your suggestion

I used your code and I only made a change at

"dimensions" to "dimension"

 

(if (eq (setq SS (ssget "X" (List (cons 0 "dimensions")))) nil)

 

It took me quite a long to find it, but it works perfectly.

Thank you very very much!!!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta