Solved! Go to Solution.
Solved by maratovich. Go to Solution.
Solved by kajanthangavel. Go to Solution.
I found this lisp has the same idea as mine but it can't sort in the order I want.
(defun c:RCC2 (/ en layername objects ct enlist add-zeros)
(setq en (entsel "\nSelect an object on the layer")) ; select an object on the layer desired
(setq layername (cdr (assoc 8 (entget (car en))))) ; extract the name of the layer from that object
(setq objects (ssget "X" (list (cons 8 layername)))) ; use that name to select all objects on that layer in the drawing
(setq ct 0) ; set iterator to 0 in prep for loop
(repeat (sslength objects) ; start loop, repeat for as many objects as there were found
(setq layer (strcat layername (itoa ct))) ; make a string with our new layer name, layer1, layer2, etc.
(command "-layer" "_n" layer "") ; make the new layer
(setq enlist (entget (ssname objects ct))) ; get the object's entity data
(setq enlist (subst (cons 8 layer) (assoc 8 enlist) enlist)); update object's entity data with new layer name
(entmod enlist) ; update the object
(setq ct (1+ ct)) ; increment iterator
) ; end loop
(princ)
)
Try this ...
Code Here...
(defun nLayer (Nme Col)
(if (not (tblsearch "LAYER" Nme))
(entmake (list (cons 0 "LAYER")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbLayerTableRecord")
(cons 2 Nme) ; Layer name
(cons 70 0)
(cons 62 Col) ; Colour
(cons 6 "Continuous") ; Line type
(cons 290 1) ; plot
(cons 370 0)) ;lineweght
)
(prompt (strcat "\n" Nme " - Layer Already Exit"))
)
(princ)
)
(defun c:slay (/ en layername objects ct enlist add-zeros)
(setq ct 1)
(setq laycor 9)
(prompt (strcat "\nSelect Solid Reversly..."))
(if (setq objects (ssget "_:L" '((0 . "3DSOLID"))))
(repeat (setq i (sslength objects))
(setq obj (vlax-ename->vla-object (ssname objects (setq i (1- i)))))
(setq layername (vla-get-layer obj))
(setq layer (strcat layername "-" (itoa ct)))
(if (= laycor 😎 (setq laycor 9) (setq laycor 8))
(nLayer layer laycor)
(vla-put-layer obj layer)
(setq ct (1+ ct))
)
(prompt (strcat "\nSolid Not Selected...."))
)
(princ)
)
(prompt (strcat "\nType SLAY to run"))
I hope, This will help you.
Try using (ssget "F" (list pt1 pt2) can drag a line over all slices in one go, just pick pt1 pt2 as Fence option.
Thanks a lot for your help. This lisp result is exactly what I want.
But there is one problem I hope you can help me. Each time my boss changes the original solid (pouring method, size of concrete block...) I have to redo this process and a total of solids each time I have to name is around 2000 solids. Could you upgrade the lisp so I can select all the solid and it will show the same result?
Anyway, thanks again.
I've changed this: (if (setq objects (ssget "_:L" '((0 . "3DSOLID"))))
to this: (if (setq objects ((ssget "F" (list pt1 pt2) "_:L" '((0 . "3DSOLID"))))
And select using fence method (from right to left) but the order is not right. Maybe I'm doing something wrong?
thank you for your comment.
I write code with
(vl-sort lst (function (lambda (a b) (< (cdr a) (cdr b)))))
This is not sort that solid.
If you have any solution. recommend to me
I am a beginner for Lisp.
Thank you. Your lisp solves 80% of my work.
I'll wait for one more day and see if anyone has another idea for the selection method.
If not I'll "Accept Solution" and happy with your lisp, just need a little bit more time to select those 2000 solids 😁
@AnonymousI tired to make selection set X axis order and Z axis order, I can not get solution,
I try to make something for you.
You can select all object, but it not uniform.
if you like fence selection
try this
I prefer the 1st method. I've tried it and it's really amazing. Thank you for your help.
Thank you for finding this topic and upgrade your software more than I asked through email.
This solves all my issues.
hi
this lsp need to modified to select 3d polyline and make new layer
example
layer-15 having 3 3d polylines i need to make layer01-15, layer02-15, layer03-15
for different layers like that
Thank you in Advance
Can't find what you're looking for? Ask the community or share your knowledge.