Jump to content

Pipe lable lisp


meecpc

Recommended Posts

I am looking for a lisp routine that will place text in a line either horizontal or vertical and break the line around the text. The one I had in Acad 2009 does not work in Acad 2015.

 

 

Thanks

Link to comment
Share on other sites

If you have the original .lisp routine it would be better to add it here, this way people can evaluate and modify your original code.

Link to comment
Share on other sites

Got a lot of command calls in that routine to change. command-s may work, but using vla-startundomark & vla-EndUndoMark instead of command calls for undo would be better code.

Untested modification:

(defun CREATESTYLE (/ CMDTST)
   (command-s "_.-style"
            "pipelabeling"
            FNT
            (* (getvar "dimscale") (distof HGHT))
            WDTH
            (while (= (getvar "cmdnames") "-STYLE") "")
   ) ;_ End command
) ;_ End defun

Link to comment
Share on other sites

Well writing code is lost on me but here is how it used to work.

 

 

ppl would start the routine

it would prompt for text height, I would give it a value then hit return

it would prompt for text string info, I would type "t", return

enter my text string, (3"san) for example, return

pick a point on a line (horizontal, vertical or angled) it would place the string in the line and trim.

 

 

Is that something you can write?

greatly appreciated.

Link to comment
Share on other sites

The lisp is enormous compared to the task obviously its been written to do a lot more. A simple strlen* fudge factor of the text and a trim would do it.

Link to comment
Share on other sites

Here is a start needs a little bit of refining to do with text styles etc and size of text.

 

; Text at mid point of a line not will not work correctly 
; with plines of multi segments
; By BIGAL June 2015
(defun C:TextAtMidPoint (/ entItem lstPoint sngDistance ans)
(setq oldsnap (getvar 'osmode))
(setq oldang (getvar 'aunits))
(setq angd (getvar 'angdir))
(setq ans (getstring "Please enter text "))
(setq sngDistance (* (strlen ans) 0.5))
(setvar 'osmode 2)
(setq pt (getpoint "pick line"))
(setq ss (ssget pt))
(setq obj (entget (ssname ss 0)))
(setq startpt (cdr (assoc 10 obj)))
(setq ang (angle pt startpt))  
(vl-cmdf "circle" pt (/ sngDistance 2.0))
(setq entItem (entlast))
(setq lstPoint (getvar "lastpoint"))
(vl-cmdf "trim" entItem "" "Nea" lstPoint "")
(vl-cmdf "erase" entItem "")
(setvar 'aunits 3)
(setvar 'angdir 0)
(vl-cmdf "text" pt ang ans)
(setvar 'osmode oldsnap)
(setvar 'aunits oldang) 
(setvar 'angdir angd) 
)
(vl-load-com)

Link to comment
Share on other sites

I am looking for a lisp routine that will place text in a line either horizontal or vertical and break the line around the text. The one I had in Acad 2009 does not work in Acad 2015.

 

 

Thanks

 

Not sure i got you , what type of text you are looking for : Polyline Length , layer name etc,,,

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