transcad Posted March 12, 2012 Posted March 12, 2012 (vlax-put-property (setq x (vlax-ename->vla-object (cdr(assoc -1 (entget(car(entsel))))))) 'Center (setq p (list 360 608 0)))) I'm trying to select a circle and to move his center to point p. I have to define a safearray for point p (setq p (list 360 608 0)). How to do this? vlax-make-safearray then vlax-safearray-fill .....?? Help! Very beginner in visual lisp... Quote
pBe Posted March 12, 2012 Posted March 12, 2012 (vlax-3d-point p) (vlax-put-property (setq x (vlax-ename->vla-object (cdr(assoc -1 (entget(car(entsel))))))) 'Center[b][color=blue] (vlax-3d-point (list 360 608 0))[/color][/b]))) (vlax-put-property (vlax-ename->vla-object [color=blue][b](car (entsel))[/b][/color]) 'Center [color=blue][b](vlax-3d-point (list 360 608 0)[/b][/color])) ([b][color=blue]vla-put-center [/color][/b](vlax-ename->vla-object [color=blue][b](car (entsel)[/b][/color])) [color=blue][b](vlax-3d-point (list 360 608 0))[/b][/color]) Quote
Lee Mac Posted March 12, 2012 Posted March 12, 2012 Also, to allow for a null selection: (if (and (setq en (car (entsel "\nSelect Circle: "))) (setq ob (vlax-ename->vla-object en)) (vlax-property-available-p ob 'center t) ) (vla-put-center ob (vlax-3D-point '(360.0 608.0))) ) Or, to avoid the Variants / Safearrays, use the undocumented vlax-put function: (if (and (setq en (car (entsel "\nSelect Circle: "))) (setq ob (vlax-ename->vla-object en)) (vlax-property-available-p ob 'center t) ) (vlax-put ob 'center '(360.0 608.0 0.0)) ) Quote
SLW210 Posted March 12, 2012 Posted March 12, 2012 transcad, Please read the CODE POSTING GUIDELINES and edit your post. Quote
Tharwat Posted March 12, 2012 Posted March 12, 2012 Multiple selection set . (defun c:Test (/ selectionset intger ) (vl-load-com) ;;; Tharwat 12. march. 2012 ;;; (if (setq selectionset (ssget "_:L" '((0 . "CIRCLE")))) (repeat (setq intger (sslength selectionset)) (vla-put-center (vlax-ename->vla-object (ssname selectionset (setq intger (1- intger))) ) (vlax-3d-point (list 360. 608. 0.)) ) ) (princ) ) (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.