Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to rotate the text polar

6 REPLIES 6
Reply
Message 1 of 7
rolisonfelipe
994 Views, 6 Replies

How to rotate the text polar

;\in original
    (setq ins_txt pt_start
);TEXT PCstart
    (vla-addMtext Space
      (vlax-3d-point (trans ins_txt 1 0))
      0.0
      (strcat
        "{\\fARIAL|b0|i0|c0|p34;"
 "PC" (itoa nb) "}" )
    );TEXT PCend


;\  how to rotate the text in this fragment and move from source x = 0, y = 0 when inserting, and made that adaptation and gives error, someone is able to risk a guess

    (setq ins_txt pt_start (polar (angle pt_start pt_cen)));TEXT PCstart 
    (vla-addMtext Space
      (vlax-3d-point (trans ins_txt 1 0))
      0.0
      (strcat
        "{\\fARIAL|b0|i0|c0|p34;"
 "PC" (itoa nb) "}" )
    );TEXT PCend

6 REPLIES 6
Message 2 of 7
DannyNL
in reply to: rolisonfelipe

Your syntax for SETQ and POLAR is incorrect.

 (setq ins_txt pt_start (polar (angle pt_start pt_cen)));TEXT PCstart 

 

See link below for the correct use of POLAR.

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-AutoLISP/file...

Message 3 of 7
rolisonfelipe
in reply to: DannyNL

Try 01

 (setq ins_txt pt_start (polar (angle pt_start pt_cen)));TEXT PCstart (polar 'pt ang dist)

 

Try 02
 (setq ins_txt pt_start (polar 'pt_start (angle pt_start pt_cen) 10 )) ;TEXT PCstart
 (polar 'pt ang dist)

ERRO : syntax error
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.
Try 03
 (setq ins_txt pt_start (polar 'pt_start (pt_start pt_cen) 10 ));TEXT PCstart  (polar 'pt ang dist)

ERRO : syntax error
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

Message 4 of 7
DannyNL
in reply to: rolisonfelipe

(setq ins_txt pt_start (polar (angle pt_start pt_cen)))
------- -------- -------------------------------
1 2 3

Should be something like:

(setq ins_txt pt_start)
(setq xyz (polar ......))

 

(setq xyz (polar (angle pt_start pt_cen)))

Should be something like:

(setq xyz (polar pt_start angle distance))
-------- ----- --------
| | |
point list | real
angle in rad
Message 5 of 7
rolisonfelipe
in reply to: DannyNL

Hi, I tried as you showed me, I applied your information, but it hasn't rotated the object yet.
                                        (polar      'pt                      ang                  dist)
                                        __|__    __|__      ______|________   __|__
 (setq ins_txt pt_start (polar  'pt_start (angle pt_start pt_cen) 10));TEXT PC     (vla-addMtext Space
      (vlax-3d-point (trans ins_txt 1 0))
      0.0
      (strcat
        "{\\fARIAL|b0|i0|c0|p34;"
 "PC" (itoa nb) "}" )
    );PCend
I added a video to show where I want to get
Thank you for not giving the fish, but for teaching to fishing
Message 6 of 7
dbhunia
in reply to: rolisonfelipe

Try like this.......

 

 

............
(setq pt_start (getpoint "\npick point for pt_start: ")) (setq pt_cen (getpoint "\npick point pt_cen: ")) (setq ins_txt (polar pt_start (angle pt_start pt_cen) 10)) (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq Space (vla-get-ModelSpace doc)) (vla-addMtext Space (vlax-3d-point (trans ins_txt 1 0)) 0.0 (strcat "{\\fARIAL|b0|i0|c0|p34;" "PC" (itoa 7) "}"));Here "7" only for demo (vla-put-Rotation (vlax-ename->vla-object (entlast)) (angle pt_start pt_cen))
............

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 7 of 7
dlanorh
in reply to: dbhunia


@dbhunia wrote:

Try like this.......

 

 

............
(setq pt_start (getpoint "\npick point for pt_start: ")) (setq pt_cen (getpoint "\npick point pt_cen: ")) (setq ins_txt (polar pt_start (angle pt_start pt_cen) 10)) (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq Space (vla-get-ModelSpace doc)) (vla-addMtext Space (vlax-3d-point (trans ins_txt 1 0)) 0.0 (strcat "{\\fARIAL|b0|i0|c0|p34;" "PC" (itoa 7) "}"));Here "7" only for demo (vla-put-Rotation (vlax-ename->vla-object (entlast)) (angle pt_start pt_cen))
............

 


 

Vla add methods return the object created. So you can avoid the (entlast) by using

 

(setq n_obj (vla-addMtext Space (vlax-3d-point (trans ins_txt 1 0)) 0.0 (strcat "{\\fARIAL|b0|i0|c0|p34;" "PC" (itoa 7) "}")));Here "7" only for demo 
(vla-put-Rotation n_obj (angle pt_start pt_cen))

 

I am not one of the robots you're looking for

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report