Need LISP to automatically put arrow arc text

Need LISP to automatically put arrow arc text

Anonymous
Not applicable
6,489 Views
30 Replies
Message 1 of 31

Need LISP to automatically put arrow arc text

Anonymous
Not applicable

I need a lisp in which i can use a single command to add an arc with arrow and text. For more clarification steps are mentioned below:

after entering command

1-select point for arrow ( i want to use my own arrow block )

2-select rotation for arrow

3-arc ( first point of arc will be the point we selected in step 1, 2nd & 3rd points we can select manually- i want to use my similar properties for arc named with "Ref. Line"  )

4- add text ( not mtext, also i want to use my similar properties for text named with "Ref. No." )

5-edit that text

6-move text

is there anyone who can help me in this?

i can't able to prepare LISP commands but i need this one. Please help me.arrow arc text.PNG

0 Likes
Accepted solutions (2)
6,490 Views
30 Replies
Replies (30)
Message 2 of 31

Kent1Cooper
Consultant
Consultant

I would strongly encourage you to use a LEADER in Spline format, rather than an Arc and separate arrowhead Block.  It can handle a lot of what you want to do for you, and the "aim" of the arrowhead will always be appropriate to the "line" part, even if the route is altered later by Stretching or grip-editing.  Set up a Dimension Style  incorporating your custom arrowhead for Leaders, and do something like this [minimally tested]:

 

(defun C:RAT (); = Reference Arrow with Text
  (setvar 'clayer "Ref. Line"); for the arrow/line part
  (command
    "_.dimstyle" "_restore" "YourLeaderDimStyle"
    "_.leader" pause pause "_format" "_spline" pause "" (getstring T) "" ; single line
    "_.explode" "_last" ; turn the Mtext into Text
    "_.chprop" "_last" "" "_layer" "Ref. No." "" ; put it on its Layer
  ); command
  (princ)
); defun

I can have more added to return the current Layer to what it was, and the current Dimension Style if you like, and the usual other enhancements.

 

[But if the difference between the curvature of a 3-point Spline-format Leader and an Arc really matters to you (this has come up before), I would at the very least do something that draws the Arc first, and then  puts in the arrowhead Block, so you can more appropriately aim it.  I suspect with putting the Block in first, you would often want to change its rotation a little after  you draw the Arc.]

Kent Cooper, AIA
0 Likes
Message 3 of 31

Anonymous
Not applicable

Hi Cooper
Thanks for your reply, I can't able to run this. I am not good in preparing commands. i just know how to load it. From last 3 years i was using 2 commands containing these steps ( for arrow head & spline ). but now i don't have these.
as you suggested "I would at the very least do something that draws the Arc first, and then puts in the arrowhead Block, so you can more appropriately aim it", i am ok with that also. But sometime i need to change the direction of the arc, to resolve this issue i am using arrow head as a block only.

 

 

mirror.PNGarrow....PNG

0 Likes
Message 4 of 31

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... I can't able to run this. I am not good in preparing commands.  i just know how to load it. …. sometime i need to change the direction of the arc, to resolve this issue i am using arrow head as a block only.

 


 

If by "preparing commands" you mean getting them into a form that you can load, Ctrl+C Copy the code and Ctrl+V Paste it into a plain-text editor such as Notepad, and save it to a file [call it whatever you want] with a .lsp filetype ending.  Load that, then type in the command name to use it.  The command name is always the part immediately after (defun C: , in this case, RAT.

 

The use of a Leader will completely eliminate any need to change the direction of the Arc and/or the Block -- they will always be appropriately aimed in the same direction.

Kent Cooper, AIA
0 Likes
Message 5 of 31

Anonymous
Not applicable

Thanks 

Its working. But i need two modifications in this.

-I want to add my own arrow ( I added my arrow, but it was not aligned with that spline )

-I want 3 point arc ( 1st point will be point of arrow, 2nd will be center of arc[arc used in my arrow] & 3rd point can be taken manually)

Please provide me this. I really appreciate that.

0 Likes
Message 6 of 31

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

-I want to add my own arrow ( I added my arrow, but it was not aligned with that spline )

....


 

To use a custom arrow in a Dimension Style for Dimensions and/or Leaders, it has to defined with its point aiming in the 0-degree direction.  I expect yours is defined aiming the other way.  You can make a duplicate facing the right way to use in Dimensions/Leaders.

Kent Cooper, AIA
Message 7 of 31

Anonymous
Not applicable

Please let me know how to replace spline with arc.

0 Likes
Message 8 of 31

ronjonp
Mentor
Mentor

You really should use an mleader style for this. You either get straight or splined leaders and you can define your arrow block. IMO having 3 separate objects for this will create a mess when trying to edit later.

Message 9 of 31

Anonymous
Not applicable

i am using spline for different purpose. i need arc with my own arrow & text style.

i need arrow, arc ( 3 point arc ) & text commands in one command. I will rotate that arrow & manage 3 points of arc manually. If you put these 3 in one lisp, it would be great.

0 Likes
Message 10 of 31

dlanorh
Advisor
Advisor
If you attach a drawing containing only your arrow block in Autocad2010 format I can give you a lisp that will do that. The routine relies on a particular Multileader style containing the arrow block, and calculates the required arrowhead rotation angle from the arrowhead scale.

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

0 Likes
Message 11 of 31

Anonymous
Not applicable

sorry for late reply.

Here i am sharing the cad file.

Thanks in advance.

0 Likes
Message 12 of 31

dlanorh
Advisor
Advisor
i will need to change the "arrow" block to fit in with a MLeader style (Rotation and size).
The new MLeader style is called "ARC". It's only use is to enable the correct calculation of the alignment of the arrowhead and text with the arc. The leader is then exploded, the linework removed and the arrowhead rotation adjusted. This happens so fast you probably won't see it.

First question, does the block need to be "red" in colour.

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

0 Likes
Message 13 of 31

Anonymous
Not applicable

Please make size of text & Block similar.

Its ok to change the color, but don't change the properties.

0 Likes
Message 14 of 31

dlanorh
Advisor
Advisor
Accepted solution

Attached are the Lisp and drawing. The drawing contains a new arrow block  ( name "newarrow") and a Multileader style ("Arc"). I suggest you insert this drawing into your template drawing then everything is in place for every new drawing.

 

To load the lisp type "appload" on the command line (no quotes). Navigate to where you saved it and press load.

Type "ml2arc" on the command line to run (no quotes)

 

The lisp initially checks to see if MultiLeader Style "Arc" is present in the drawing. If it isn't it quits.

It then asks for the TEXT, then for the arrow point.

 

It then asks you to construct an arc using the point selected as the first point. The drawing contains four of these, all constructed with the lisp

 

To change the arrow size or text size, type "mleaderstyle" on the command line
This will bring up the multiLeader style manager
Select the "Arc" Style from the list on the left side and press the "Modify" Button
On the next pop up, the arrowhead size can be changed on the "Leader Format" Tab;
and the text size on the "Content" Tab

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

Message 15 of 31

Anonymous
Not applicable

Yesss..... Thank you so much  dlanorh. Its working. can you prepare something similar for the spline ( without arrow ).

Again thank you for this.

 

"https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-lisp-to-add-text-with-spline/m-..."

 

text spline.PNG

0 Likes
Message 16 of 31

dlanorh
Advisor
Advisor
Is this a leader or Mleader, or is it a spline with text?

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

0 Likes
Message 17 of 31

Anonymous
Not applicable

its a spline with text

0 Likes
Message 18 of 31

Anonymous
Not applicable

please check the attachment for more info.

0 Likes
Message 19 of 31

dlanorh
Advisor
Advisor
Lisp for Spline and Text posted in other thread

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

0 Likes
Message 20 of 31

Anonymous
Not applicable

can you please modify below points in it:

1) I want to put arrow, arc & text in different layers ( "solid" for arrow, " Ref. line" for arc & "Ref. No." for text ).

2) I want to place text manually.

Thanks in advance.

0 Likes