Create a macro to do selection

Create a macro to do selection

filapost
Participant Participant
754 Views
3 Replies
Message 1 of 4

Create a macro to do selection

filapost
Participant
Participant

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

0 Likes
Accepted solutions (1)
755 Views
3 Replies
Replies (3)
Message 2 of 4

Kent1Cooper
Consultant
Consultant

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
0 Likes
Message 3 of 4

Anonymous
Not applicable
Accepted solution

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

0 Likes
Message 4 of 4

filapost
Participant
Participant

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!!!

0 Likes