fabang
Guest
Hey, guys, I haven't been here for a few years. I'm putting my problem on.
on the net I found this lisp that selecting a solid or region, draws a circle "red" in the position of its centerpiece.
until here everything ok, my problem arises from the fact that I need to select more solid together, but the little program makes me select a solid at a time.
I refer to someone who can modify the lisp and extend the selection not to just one object but to more objects.
below I cover all the program, which maybe can return useful to someone.
bye and thanks:
;cog3d - draws the center of a solid or region
;
(defun c:cog3d ( / ent coords objent-vl)
(vl-load-com)
(setvar "cmdecho" 0)
(while (not (setq objent (car (entsel "\nselect solid 3d or region: ")))
)
(while (not (member (setq ent (cdr) (assoc 0 (entget objent)))) (3dsolid) (region)))
(sing)
(strcat "\n [Bleep] not valid - " ent)
)
(while (not (setq objent (car (entsel "\nselect solid 3d or region: ")))
)
)
(setq objent-vl (vlax-ename->vla-object objent))
(setq coords (vlax-get objent-vl "centroid"))
(command "circle" coords (/ (getvar "viewsize") 50);draw it
(command "_.chprop" "_l" "_col" "1"")
(princ (strcat "\nbaricentro:\nx=" (rtos(car coords) " y=" (rtos(cadr coords)) " z=" (rtos(caddr coords))))
(setvar "cmdecho" 1)
(principles)
)
(princ "cadstudio cog3d command loaded")
(principles)
on the net I found this lisp that selecting a solid or region, draws a circle "red" in the position of its centerpiece.
until here everything ok, my problem arises from the fact that I need to select more solid together, but the little program makes me select a solid at a time.
I refer to someone who can modify the lisp and extend the selection not to just one object but to more objects.
below I cover all the program, which maybe can return useful to someone.
bye and thanks:
;cog3d - draws the center of a solid or region
;
(defun c:cog3d ( / ent coords objent-vl)
(vl-load-com)
(setvar "cmdecho" 0)
(while (not (setq objent (car (entsel "\nselect solid 3d or region: ")))
)
(while (not (member (setq ent (cdr) (assoc 0 (entget objent)))) (3dsolid) (region)))
(sing)
(strcat "\n [Bleep] not valid - " ent)
)
(while (not (setq objent (car (entsel "\nselect solid 3d or region: ")))
)
)
(setq objent-vl (vlax-ename->vla-object objent))
(setq coords (vlax-get objent-vl "centroid"))
(command "circle" coords (/ (getvar "viewsize") 50);draw it
(command "_.chprop" "_l" "_col" "1"")
(princ (strcat "\nbaricentro:\nx=" (rtos(car coords) " y=" (rtos(cadr coords)) " z=" (rtos(caddr coords))))
(setvar "cmdecho" 1)
(principles)
)
(princ "cadstudio cog3d command loaded")
(principles)