Jump to content

Recommended Posts

Posted

(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...

Posted

 
(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])

Posted

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

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...