Jump to content

Help: insert Mline length and Mline scale on Mline


luongthevinh

Recommended Posts

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.

:)

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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