luongthevinh Posted August 26, 2016 Share Posted August 26, 2016 As topic, I want to insert Mline length and Mline scale on Mline for show contractor. Please help me to solve a problem with Lisp Thank's alot. Quote Link to comment Share on other sites More sharing options...
broncos15 Posted August 26, 2016 Share Posted August 26, 2016 As topic, I want to insert Mline length and Mline scale on Mline for show contractor.Please help me to solve a problem with Lisp Thank's alot. I am confused what you are asking for. Are you looking to put the length and scale above the mline (i.e. label it), or are you asking for something else? If you are asking how to find those values, then look at the function vla-get-mlinescale. To get the length of the object will be a little trickier because there is not a direct function for it unfortunately. However, you can find the points of the mline (dxf group codes 11). From there you can calculate the length. Let me know if you have any questions. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 27, 2016 Share Posted August 27, 2016 broncos15 as the mline has an inside and an outside offset and these can be diffrent the co-ords are for the line creation, I may be wrong but it may be easier to recreate a new pline, offset it, get length, label it, then erase it . You need the "style name" info all the offsets. Now where is that. Quote Link to comment Share on other sites More sharing options...
luongthevinh Posted August 27, 2016 Author Share Posted August 27, 2016 Yes, I mean put the length and scale above the mline. As the same lisp in Lee-Mac http://www.lee-mac.com/midlen.html. use for pline. I want for Mline with length and scale above the mline. Can you help me!. Thank's so much. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 27, 2016 Share Posted August 27, 2016 The lisp by Lee would need a big rewrite as the objects are just so different the code supports two things the length of an object and ability to find a mid point, both of these are just not built in to a Mline, so its easier to just start again. ; this is the guts not a complete code to see how to get the answers. ; For me just create a new pline then use parts of Lee's code as the field "length" is not supported. (setq obj (vlax-ename->vla-object (car (entsel "\nPick mline")))) (setq co-ords (vlax-get obj 'coordinates)) ; eg (8696.29 1287.81 0.0 12479.4 1242.65 0.0 12765.7 3184.44 0.0) xyz 2 lines (setq numb (/ (length co-ords) 3)) (setq I 0) (command "_pline") (while (= (getvar "cmdactive") 1 ) (repeat numb (setq xy (list (nth I co-ords)(nth (+ I 1) co-ords) )) (setq I (+ I 3)) ) ; end repeat ) ; while (setq ent (vlax-ename->vla-object (entlast))) (setq len (vla-get-length ent)) (setq par (vlax-curve-getparamatdist ent (/ (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)) 2.0))) (setq ins (vlax-curve-getpointatparam obj2 par)) (alert (strcat "length is " (rtos len 2 2) ) ; add text part now as per Lee's code (vla-delete ent) ; no longer need new pline 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.