Jump to content

Draw Polyline with Specified Max. Length & Insert Text For Length


JCYK
 Share

Recommended Posts

Sometimes having a go your self is part of the learning curve just google "pline field lisp autocad" lots of examples. Its only a few lines that is required it about writing the correct string to the text 

 

This is an example of the string each object has a ID %<\AcObjProp Object(%<\_ObjId 990441952>%).Length \f "%lu2%pr1">%

Link to comment
Share on other sites

Yes I have googled that but still have no clue how all these coding works and how I could modify them. Anyway I've just started to learn Lisp routine from zero whenever I have free time, an interesting journey I must say, and probably one day I would be able to do that. Thank you!

Link to comment
Share on other sites

Try this change just replace the put

 

(vla-put-TextString txt (strcat  "%<\\AcObjProp Object(%<\\_ObjId "
                          (itoa (vla-get-Objectid pl)) ">%).Area \\f \"" "%lu2%pr2" "\">%"
                         ))

 

Link to comment
Share on other sites

  • 2 weeks later...

You are right...

 

Hi @Jonathan Handojo, I didn't want to bother you again as you have helped me a lot. But I guess this is my last resort and you are actually the best and right person on this as the lisp was written by you...

 

As mentioned in my earlier post I was wondering is it possible to enhance the lisp by having the length text to be linked to the polyline (unless someone explode it) such that when one adjusts the polyline vertex which will change the length (but still has a cap to the original specified max. length, if possible), the length text displayed will be automatically updated accordingly? 

 

Thank you! 🙏 :)

Link to comment
Share on other sites

Sorry, I've been off for quite some time and lost track of what's happening here as I've been very busy myself.

 

If you change the vertex of the end point of the polyline, doesn't that mean that you also want to change the location arrowhead as well? if that's so, it's gonna be one hell of a massive code change using reactors and I'm not very excellent at that.

 

 

10 hours ago, JCYK said:

(but still has a cap to the original specified max. length, if possible)

 

Changing the polyline such that the length does not exceed a certain number is possible using LISP, but it's a very tedious task. It's like creating a STRETCH command on the polyline without exceeding the line limit (or in other words, as good as creating a new LISP command).

 

However, I can amend the length using fields as how BIGAL have suggested.

Link to comment
Share on other sites

I would add a move and update version just redoing the end arrow. Much easier than a reactor. Is it just a update rotation of last point angle ?

 

 

Edited by BIGAL
Link to comment
Share on other sites

15 hours ago, Jonathan Handojo said:

 

On 6/3/2020 at 7:45 PM, JCYK said:

(but still has a cap to the original specified max. length, if possible)

 

Changing the polyline such that the length does not exceed a certain number is possible using LISP, but it's a very tedious task. It's like creating a STRETCH command on the polyline without exceeding the line limit (or in other words, as good as creating a new LISP command).

 

However, I can amend the length using fields as how BIGAL have suggested.

 

Okay, for amending polyline part it's fine not to keep to the limit then. If the live display of length will still be present (when adjust the polyline) I could still look at it to know if the max length has been reached. 

 

Would be great if you can help amend the length using fields! 😃 

 

15 hours ago, Jonathan Handojo said:

If you change the vertex of the end point of the polyline, doesn't that mean that you also want to change the location arrowhead as well? if that's so, it's gonna be one hell of a massive code change using reactors and I'm not very excellent at that.

 

Yes you are right on the arrowhead... I didn't know it will be a massive code change 😛 Hope someone has a simpler solution on this to share? Thank you!

 

 

Link to comment
Share on other sites

4 hours ago, JCYK said:

 

Hope someone has a simpler solution on this to share? Thank you!

 

 

 

 

just $0.02 idea, not sure it helps? 

1.manually place DIMALIGNED at end segment of polyline.

2.suppress all dim & ext lines, leave only one arrow & dim line at the end tip & adjust size etc..

3.replace measurement, inserting FIELD (object->length property)

   ;if last segment vertices moved, the dimension 'TEXT' & Arrow head should follow end point of last segment.

4.command: REGEN or UPDATEFIELD

 

 

  • Like 1
Link to comment
Share on other sites

Sounds like a solution.

 

Hi @Jonathan Handojo, what do you think, is this something that can be incorporated in your lisp without too much hassle? =p

 

If can be done I can try to create a dim style with customised arrowhead for you to incorporate? 

Link to comment
Share on other sites

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

 Share

×
×
  • Create New...