Jump to content
battman

field text in a linetype

Recommended Posts

battman

Hi All, i'm trying to make a new linetype with text, but i want the text to have a field that displays the length of the line. Does anyone know how to do this? Or if it's possible?

Any help would be much appreciated!

Share this post


Link to post
Share on other sites
battman

thanks ReMark, the reason I would want it to be a linetype though would be so that I can have multiple segments, like as a polyline, and it can display the total length of the polyline. I'm thinking something like the GAS linetype or the HOT WATER supply linetype, but where the text is a field.

Share this post


Link to post
Share on other sites
ReMark

Can't say I've seen anything like that and any workaround I have tried has been too clunky.

Share this post


Link to post
Share on other sites
BIGAL

On a single line it can be done using a dimension, but thats not applicable for a pline.

 

Like Remark what about just pick and update objects or search by layer etc.

Share this post


Link to post
Share on other sites
steven-g

Someone might know a way with LISP, you could use the measure command and insert a block with a field along a line/pline, you could of course add other text or a wipeout or background hatch

field.dwg

Share this post


Link to post
Share on other sites
BIGAL

This is based on Steven-g dwg it will label but if you change the pline the blocks do not change, one way around this is to erase all the blocks move the pline then redo the (c:plen), this involves other routines but the method is quite simple using ssget "F" done below

 

Simplest is the need to be able to put the field in a .LIN

A,5.08,-5.08,5.08,-5.08,["G",STANDARD,S=1.8,R=0.0,X=-1.8,Y=-.9],-3 need the "G" to be a field.

 

(defun c:plen ( / obj)
(setq obj (entsel "Pick line or pline"))
; probably want a layer set here
(command "measure" obj "B" "len" "Y" (getdist "enter spacing"))
)

 

; pline co-ords example
; By Alan H
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)

; erase blocks 
(defun c:eraseblk ( / ss)
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy) ; list of 2d points making pline
(setq ss (ssget "f" co-ordsxy (list (cons 0 "Insert"))))
(command "erase" ss "")
)

Edited by BIGAL

Share this post


Link to post
Share on other sites
battman

Thanks everyone,

BIGAL, I used the first code you wrote above and saved it as a .lsp, loaded it with appload, and used the command "plen" on steven-g's drawing. It placed a measurement along my pline in regular intervals, which is great! but the measurement was always 15.81 m... which was the length of steven-g's line that he drew. When I draw a new line, it doesn't know to measure that one. Maybe the answer is in the second code you provided... but my novice autocad brain doesn't understand what to do with it.

Share this post


Link to post
Share on other sites
BIGAL

I tested the small plen again at 2000 as spacing on a new pline and works fine, you may need to play with the dynamic block in terms of scale etc for small distance.

 

Used Bedit to edit block maintain insertion point.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×