+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Forum Newbie
    Using
    AutoCAD 2016
    Join Date
    Mar 2015
    Posts
    5

    Default field text in a linetype

    Registered forum members do not see this ad.

    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!

  2. #2
    Forum Newbie
    Using
    AutoCAD 2016
    Join Date
    Mar 2015
    Posts
    5

    Default

    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.

  3. #3
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,375

    Default

    Can't say I've seen anything like that and any workaround I have tried has been too clunky.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,727

    Default

    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.
    A man who never made mistakes never made anything

  5. #5
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,042

    Default

    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
    Attached Files

  6. #6
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,727

    Default

    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.

    Code:
    (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"))
    )
    Code:
    ; 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 "")
    )
    Last edited by BIGAL; 23rd Apr 2016 at 01:47 am.
    A man who never made mistakes never made anything

  7. #7
    Forum Newbie
    Using
    AutoCAD 2016
    Join Date
    Mar 2015
    Posts
    5

    Default

    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.

  8. #8
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,727

    Default

    Registered forum members do not see this ad.

    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.
    A man who never made mistakes never made anything

Similar Threads

  1. Dim text linked to another Dim using a dynamic text field
    By Manila Wolf in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 10th Jan 2015, 07:22 am
  2. Sum Text Strings to Text Field...
    By tomjas in forum AutoLISP, Visual LISP & DCL
    Replies: 58
    Last Post: 1st Jul 2013, 08:05 pm
  3. Replies: 10
    Last Post: 5th Apr 2011, 04:43 pm
  4. Text Field Lisp??
    By feargt in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 29th Apr 2009, 07:35 am
  5. Field text editing
    By Nippon in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 31st Jul 2006, 09:18 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts