vla-get/put command help . . .

Discussion in 'AutoCAD' started by swu, Jan 25, 2005.

  1. swu

    swu Guest

    I need some assistance, making a visual lisp routine to paste the rotation from one text entity to another.

    entire code:

    (defun C:pastetextangle ( / ent_source ent_target rot lay)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    (vl-load-com)

    (setq acadobject (vlax-get-Acad-Object))

    (setq activedocument (vla-get-activedocument acadobject))

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    (setq ent_source (car (entsel "\nSelect Source Text: ")))
    (setq ent_source (vlax-Ename->Vla-Object (car ent_source)))

    (vla-get-layer ent_source))

    ;(princ rot)

    ;(setq ent_taret (car (entsel "\nSelect Source Text: ")))
    ;(setq ent_target (vlax-Ename->Vla-Object (car ent_target)))

    ;(vla-put-rotation rot)




    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (princ)

    );defun

    (princ)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    Thanks in advance
     
    swu, Jan 25, 2005
    #1
  2. swu

    Jürg Menzi Guest

    Hi swu

    You apply 'car' twice...
    shold be:
    (setq ent_source (car (entsel "\nSelect Source Text: ")))
    (setq obj_source (vlax-Ename->Vla-Object ent_source))

    to get the rotation:
    (setq rot_source (vla-get-Rotation obj_source))

    to put the rotation:
    (setq ent_target (car (entsel "\nSelect Target Text: ")))
    (setq obj_target (vlax-Ename->Vla-Object ent_target))
    (vla-put-Rotation obj_target rot_source)

    Cheers
     
    Jürg Menzi, Jan 25, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.