Jojo Posted October 26, 2023 Share Posted October 26, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
Danielm103 Posted October 27, 2023 Share Posted October 27, 2023 One approach might be, get the distance from the mtext, pass that to an argument in vla-Offset Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 27, 2023 Share Posted October 27, 2023 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) ) Quote Link to comment Share on other sites More sharing options...
orborneee Posted November 14, 2023 Share Posted November 14, 2023 I want to refer to the most optimal approach! Super Mario Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 15, 2023 Share Posted November 15, 2023 Please explain. Quote Link to comment Share on other sites More sharing options...
Jojo Posted January 3 Author Share Posted January 3 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 4 Share Posted January 4 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. Quote Link to comment Share on other sites More sharing options...
Jojo Posted January 4 Author Share Posted January 4 That work perfect. thank you very much and thank you for helping people like me. Quote Link to comment Share on other sites More sharing options...
Jojo Posted January 5 Author Share Posted January 5 @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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 7 Share Posted January 7 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. 1 Quote Link to comment Share on other sites More sharing options...
Steven P Posted January 7 Share Posted January 7 Lee Mac Unformat String: http://lee-mac.com/unformatstring.html Stripmtext: https://cadabyss.wordpress.com/ Quote Link to comment Share on other sites More sharing options...
Jojo Posted January 9 Author Share Posted January 9 That work! thank you both. awesome!!! Quote Link to comment Share on other sites More sharing options...
Jojo Posted August 26 Author Share Posted August 26 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! Quote Link to comment Share on other sites More sharing options...
mhupp Posted August 26 Share Posted August 26 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) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 26 Share Posted August 26 "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. Quote Link to comment Share on other sites More sharing options...
Jojo Posted August 27 Author Share Posted August 27 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. Quote Link to comment Share on other sites More sharing options...
Jojo Posted August 27 Author Share Posted August 27 (edited) One single line object to offset multiple times in the same direction. Thank you Edited August 27 by Jojo Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 27 Share Posted August 27 Are you trying to make a "Table" of the text ? Really need a before and after of finished dwg. COT_Convert_Old_Table-V1.6a.lsp Quote Link to comment Share on other sites More sharing options...
Jojo Posted August 28 Author Share Posted August 28 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 29 Share Posted August 29 (edited) 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. 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 August 29 by BIGAL Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.