Jump to content

Offset polyline


Jojo

Recommended Posts

Looking for LSP for offset polyline by selecting mtext with value . I have a polyline that I need to offset with different distance and it would be great if I can just select the text and it will offset it automatically. 

  • Like 1
Link to comment
Share on other sites

Need the mtext examples as if it has extra control inside it may affect the way the value is returned.

 

Like this no error check wrong object picked. 

(defun c:wow ( / ent val obj)
(setq ent (entget (car (entsel "\nPick mtext "))))
(setq val (atof (cdr (assoc 1 ent))))
(setq obj (vlax-ename->vla-object  (car (entsel "\nPick object for offset "))))
(vla-offset obj val)
(princ)
)

 

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
On 10/26/2023 at 11:57 PM, BIGAL said:

Need the mtext examples as if it has extra control inside it may affect the way the value is returned.

 

Like this no error check wrong object picked. 

(defun c:wow ( / ent val obj)
(setq ent (entget (car (entsel "\nPick mtext "))))
(setq val (atof (cdr (assoc 1 ent))))
(setq obj (vlax-ename->vla-object  (car (entsel "\nPick object for offset "))))
(vla-offset obj val)
(princ)
)

 

 

It's exactly what I'm looking for but what do I change or what do I change it to, to control the direction. Right now when I offset the line it's just going left. thank you in advance.

Link to comment
Share on other sites

When you use (vla-offset obj val) it will always offset based on the drawn direction of the source object, if you imply a -ve value for the offset it will go the other way. Draw 2 lines one down, 1 up and use the code. You can as an extra step ask offset other side.

Link to comment
Share on other sites

@BIGAL I finally get to test it out in my actual work that I was really excited about, and it didn't work. I was trying to figure it out why it's not working, and I noticed that my text width factor is 0.08 and the other mtext have underline. I tried removing the underline and made the width factor to 1.00 but it's just a lot of mtext editing. Can you please help me when you have time? thank you in advance.

Link to comment
Share on other sites

With mtext you can use a stripmtext that will remove the control stuff and you end up with a plain text, google Lee-mac stripmtext.

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
On 10/26/2023 at 11:57 PM, BIGAL said:

Need the mtext examples as if it has extra control inside it may affect the way the value is returned.

 

Like this no error check wrong object picked. 

(defun c:wow ( / ent val obj)
(setq ent (entget (car (entsel "\nPick mtext "))))
(setq val (atof (cdr (assoc 1 ent))))
(setq obj (vlax-ename->vla-object  (car (entsel "\nPick object for offset "))))
(vla-offset obj val)
(princ)
)

 

 

Hello. Hopefully I'm not asking for too much but is there anyways that we can edit this lisp to select multiple text to offset instead of one at a time? I have a lot of numbers to offset in the same direction like sometimes 20 to 50 mtext to offset in the same direction. I really appreciate the help. Thank you!

Link to comment
Share on other sites

3 hours ago, Jojo said:

Hello. Hopefully I'm not asking for too much but is there anyways that we can edit this lisp to select multiple text to offset instead of one at a time? I have a lot of numbers to offset in the same direction like sometimes 20 to 50 mtext to offset in the same direction. I really appreciate the help. Thank you!

 

use move and ssget. if its a text that always on a specifice layer you can add it to the ssget filter to only select that type of text.

 

;;========================================================================;;
;; Move Text 
(defun c:MT (/ SS PT1 PT2)
  (if (setq SS (ssget '((0 . "TEXT,MTEXT")))) 
    (progn
      (princ "\nNo text objects selected.")
    )
    (progn
      (setq PT1 (getpoint "\nSpecify base point: "))
      (setq PT2 (getpoint PT1 "\nMove Distance: ")) ;use mouse to select distance and direction to move
      (command "_.MOVE" SS "" PT1 PT2)
      (princ (strcat "\n" (itoa (sslength SS)) " Text objects moved."))
    )
  )
  (princ)
)

 

Link to comment
Share on other sites

"select multiple text to offset " there is no problem doing multiple but is it for one object multiple times or different objects to be offset. Need a dwg sample, with before and after.

Link to comment
Share on other sites

15 hours ago, BIGAL said:

"select multiple text to offset " there is no problem doing multiple but is it for one object multiple times or different objects to be offset. Need a dwg sample, with before and after.

 

Link to comment
Share on other sites

Posted (edited)

image.png.3559a611a572520bd27dfcfe00b44ec5.png

One single line object to offset multiple times in the same direction. Thank you

Edited by Jojo
Link to comment
Share on other sites

Hello Bigal. I attached the dwg for you to look at and hoping that we can edit the lsp to offset a single line with those numbers. thank you in advance.

TEST.dwg

Link to comment
Share on other sites

Can not open dwg did a recover and got open.

 

You could have used wblock to make a dwg much smaller.

 

Is this what you want. Based on offset.

image.png.a8aba71bc9ace4b445bb7f84ab4da211.png

 

What software are you using to make the sections ? I use Civil Site Design and it has a lot of powerful tools and may be able to do this. 

Edited by BIGAL
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
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...