AutoCAD Visual LISP / AutoLISP :: How To Mimic Enter Key For Next Line Of Text

Oct 25, 2012

I am writing a program that allows the user to select hatched areas in a drawing and return the quantity, area, and the weight for the equivalent areas covered by tread plate.

My goal is to insert the data with text at a point of the user's choosing, so the end result is a text object in model space that looks like this:

Total Objects: 2
Total Tread Plate Area: 20.83 sq ft
.125 AL Tread Plate Weight: 40 lbs
.125 Steel Tread Plate Weight: 128.33 lbs

How to do is to have the text appear on multiple lines, instead of all across one line. Is there a way to mimic the enter key to enter the next line of text, just like when you use the text function in AutoCAD, instead of using multiple text commands and having to position each one using code.

(defun c:tread (/ cnt tot ss p sqft alwt stwt)
(vl-load-com)
  (setq    cnt 0
    tot 0

[Code] .....

View 5 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Create Two Line MLEADER - Only Get One Line Of Text

Jul 18, 2012

I'm trying to write a lisp routine to create a two line MLEADER but i can only get one line of text. Creating the MLEADER manually from the command line i just have to hit enter after the first line of text to add a second line. How would i do this in a lisp routine?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Add Text To Command Line

Nov 18, 2013

I have a custom command that I can initiate (c:TxtE).  The function starts running but I need to begin adding several inputs at the command line following this.  (ex:  "4" "all" "" "oldtext" "newtext").  How do i do that within lisp once the custom command has already begun?  If I need to modify the function how would i pass all these as optional type variables?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Multiple Text To Line

May 31, 2012

I have some general knowledge in lisp coding. But I can't seem to figure this one out (even to get started). What I want to do is make a lisp that:

 - selects a line

then

 - select any amount of text (any type)

then

 - moves all the text to that selected line without rotating the text

if a line is perfectly horizontal then move the text of the y axis.

if the line is vertical then move the text of the x axis.

or there can be a prompt asking the user to chose the angle or axis in which the text will move (say if they want to move the text to a slanted line, you can choose to move the text on an angle, while keeping the same format and not rotating the text, or you can ask the user if they want to move it only vertically or horizontally)

I would really like the code to integrate into my autocad.  

See pictures

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reading A Line In Text File

Sep 27, 2011

I have the following code which isnt quite working, it reads a text file which has a list of Names of images and their bottom left coordinates i.e. name x y etc. I want it to check for a name equal to that input then in this case alert the user it is found, eventually I want it to load the tile but for the moment where am I going wrong, also the lisp wont close the file and I dont know why.

(defun c:imi ()
  (setq IM (getstring "
Input name of 2010 tile"))
 (while (not (= ""  IM))
  (setq TILE (strcat "BM" IM))
  [Code] ......

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Line With Text Offset

May 6, 2013

I am a beginner at LISP and this is a bit out of my league... and I'm trying to create a lisp where I can draw a polyline between 2 points that also places text with the actual distance offset above the line.

I did find this post and I'm not quite catching on.. [URL] ......

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Unable To Get Out From While Loop If Press Enter

Jun 18, 2013

I am just a begineer for auto lisp.  I wrote my first program, but got stuck,  I am unable to get out from while loop if i Press "enter".

(defun c:arsh ()
(while
(setq p1 (getpoint "
pick point :"))
(setq l 1500)
(setvar "osmode" 0)
(initget 7)
(setq p2 (polar p1 (dtr 0) l))
[code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Explode Mtext - Get X Y Coordinates Of Last Line Of Text

Mar 19, 2012

Would like to be able to select mtext explode it get x y coords of last line of text then turn it back to mtext and then launch mtext at a @0,-0.5  justification TL width 5 and display the ribbon.

All seems to work except the (command ...)

Below is my attempt.

(prompt "Select Note")
(setq ss (ssget))
(command "explode" ss)
(setq ss (ssget "l")) ;get last line of text

(setq ent (entget (ssname ss 0))
ent1 (cdr (assoc 10 ent))) ;get x y coords
(command "undo" "1") ;set exploded mtext back to mtext
(setvar "lastpoint" ent1)

(command "mtext" "@0,-0.4" "j" "TL" "w" "5")

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Put Default Text On Command Line For Getstring

Jun 6, 2012

I am trying to get a default value (from global variable) put as the default for getstring command. Problem is I want it as if I had typed it into the getstring command so I can modify it if required. It is for entering filenames which only change slightly ie 1129E09LS1 ...LS2 ...XS1 etc.

Current
(setq BlkName (getstring "
Enter Civil Cad File to Import: "))
For defaults that I don't want to change I usually use this format:
(or BlkName (setq BlkName (getstring "
Enter Civil Cad File to Import: ")))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Copy Text Or Line Then Change Its Color To Green

Mar 29, 2013

I'm looking for a way to copy a text or a simple line, circle... ; after I copied it, the last entity change its color to green.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Line / Pline To Match TEXT Rotation?

Oct 7, 2011

There are a ton of lisp to match text rotation to a selected line, but not vice versa.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Sorting Multi Line Text In Alphabetic Order

Apr 23, 2013

I required a lisp for sorting Multiline text in alphabetic order. (Ascending and Descending)

For example in my drawing it contains lot of Mtexts having multi rows. I need to sort texts inside Mtext. Like PDC-012, DAG-012, AAG-096. I need that Mtext should be AAG-096,DAG-012,PDC-012.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Line Between Two Lines?

Feb 15, 2013

I am trying to draw a line between two lines and I put together the following. It works great if the start/end points are perpendicular to each other. How do I solve if line one start point is in a positive direction and line two is in a negative direction? 

(defun c:test ()
 (setq L1 (car (entsel "
Select the first line: "))
L2 (car (entsel "
Select the second line: "))
 )

[code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: End Of One Line Is Start Of Another

Apr 24, 2013

I am having a problem with starts and ends of lines. I have draw two lines, end of first is start of second. The problem is because, (cdr (assoc 11 (entget line1))) and (cdr (assoc 10 (entget line2))), somehow, are not the same,

(= (cdr (assoc 11 (entget line1))) (cdr (assoc 10 (entget line2)))) 

is returning nil, what is so confusing to me is that:

(=(nth 0(cdr (assoc 11 (entget line1)))) (nth 0(cdr (assoc 10 (entget line2)))))

is returning true, the same is for y and z coordinates.

I need to check x y and z coordinates, for this type of problem...

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Circles At Line End Points?

Feb 2, 2012

I need to place a circle, of a user-defined radius, as a marker at the endpoints of all lines in a drawing.  how to accomplish this using lisp?  It doesn't matter if they overlap; I can use OVERKILL to delete those objects.

I started the code with:

(defun c:cmark ()
(setq crad (getdist "
Specify radius: "))
)

But don't know how to cycle through the objects, determine the end points of lines only.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Line Length To Attribute Tag

Sep 30, 2013

Is there any simple code for to sum length of lines which is i am choosing and copying result to chosen attribute tag ?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Draw Line In A Layer

Jun 5, 2013

How do I select the layer in which I want to draw?

for example i draw two line and Each of them has to be in different layer.

How do I select the layer  which I want to draw?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete Offset Line

Sep 6, 2013

There are many lisp that draw offset line but what about opposite way , I have wall of double line i need to delete one of them let's say inside wall line .

why i need to do this usually when i tracing in external program like autocad architecture or Revit or archicad  i just need outline of exterior and interior walls !.

is there way that can delete the offset line  ?(or within range predefined in lisp to prevent interfering of lines deletion).

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Divide 3D Poly Line

Sep 21, 2011

I have little Autolisp experience, what I need is a lisp routine that will divide a 3D Poly line to say about 1000 points and add index to the points from the start of the line to the end of the line. It is very important that the index be from the start to the end of the line, because we extract the info to excel and then use the x,y and z co-ordinate of the points on our hydraulic analysis  program. We need to have the index and the x, y and z co-ordinates on our Excel sheet sorted by index and not by x, y and z.

To be more clear the 3D poly is a pipeline profile so we need to have the points in order by index and not by x, y and z.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Control UCS Without Using Command Line?

Nov 9, 2012

Is it possible to control the UCS without using the command line?  I'd like to access it and control it with vlisp much the same way I can access DXF groups and manipulate insertions.  Seems like it should be possible to play with it's definition inside the object model.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Line In The Middle Of Four Lines

Aug 10, 2013

I need lisp that do a line between 4 lines. 

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Command Line Variable

Feb 7, 2013

Somehow, I manage to turn of one variable that display errors on command line.

For example:

(seq a 6)

suppose to return, on command line, something like:

error no function definition: SEQ

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Unable To Draw A Line

Sep 18, 2013

I've written my first little Lisp function.What it's for is drawing a simple borehole profile that can then be used to draw stylized cross sections on top of it.

Upon start the lisp, pick a point on screen (to get the X coordinate [x1 below]), then enter ground level at the command line [g1 below], then enter as many thicknesses as are present in the borehole log (will vary, but typically between 3-12). These I added to a list, because that seemed to make sense when I did it.

What I want it to do then is draw a pline from x1, g1 down to the next point (x1,g1 minus the 1st thickness), then the next (x1,g1 minus the 2nd thickness) etc., to the bottom of the borehole.

Then my CAD guys can sit there, and using the borehole logs, enter the values of the boreholes and it draws them on the screen, making it easy to join th dots.

It might be good if it placed a Acad point at each point as well, but I'm not overly bothered about that at the minute.

Here's my attempt so far.

(prompt "Type 'e1' to run...")
(defun c:e1 ( / )
(command "graphscr") (setq x1 (getpoint "
Pick insertion point:")) (setq x1a (car x1))
(initget (+ 1 2 4))   (setq g1 (getreal "
Enter ground elevation: "))
(initget (+ 1 2 2)) (setq lvllist nil )   (while   (setq lvl (getreal "
Enter layer thickness <Exit>: "))   (setq lvlList (append lvllist (list lvl))) )
(princ) )

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Line Length Report

May 30, 2013

I am trying to create a report of line lengths based on linetype.

I have built a list that looks like this...

(("CUT4SS" . 859.566) ("CUT4SS" . 862.231) ("CUT4SS" . 927.651) ("CUT6SS" . 1158.48) ("CUT6SS" . 509.903) ("CUT6SS" . 2840.31) ("CUT4SS" . 967.76) ("CUT4SS" . 508.73) ("CUT4SS" . 111.065) ("CUT4SS" . 483.216))

I want to take this list and create a function to create a list of total lengths i.e. the CDR's.

(("CUT6SS" .total length)("CUT4SS" . total length))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Texts On A Line?

May 22, 2012

There is a very complecated drawing. Texts are on a line and crossing a line or something like that. Some texts has insertion points on the line. When the line is selected by LISP, only the specific texts with insertion points on the line are selected. Does it make sence?

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Line Profile And Chainage

Mar 18, 2011

Any lisp programme for creating a line profile and chainage. I have attached a sample drawing. The blocks on the line have elevation and lines are drawn from the datum .If i manually draw it will take too much time.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Place A Line Behind Other Items

Nov 13, 2012

I have a lisp file that reads in a point list from a text file and creates a number with a circle around it for every point, then a line from one circle to the next in line with the center point of each circle. Is there a simple way of making the lines "go behind the circles". The portion of code that creates the circles, lines and text is as follows and a cutout screen dump of what it looks like is below.

(setq amount 0)
(foreach item lines
;;;                                                              ;;
;;;  Create the text                                             ;;
;;;                                                              ;;
 (setq x (+ (atof (nth 2 item)) (car pt_origin)))
 (setq y (+ (atof (nth 3 item)) (cadr pt_origin)))

[Code]....

IV 2010

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get End Points Of Invisible Line?

Aug 23, 2013

I am trying to get the end points of an invisible line it would be the line that you offset I know all about polar I just don't know which angle to add or subtract and I will pick the point on the side I want it to be on I am going to pick 2 lines and I want them to offset invisible lines in the middle the lines are not parallel.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Line And Get Endpoint?

Feb 12, 2013

Can I select a line and get the nearest endpoint so I can do something to the line using the endpoint as a base?

It will include an ssget and an osnap "end" in the code, but not too sure how to put it together.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Mtext Rotate To Line

Oct 15, 2013

Lisp routine that will rotate Mtext to the same angle as the angle of a selected line and the allow you to place the mtext object where you wish.

I know there is an lisp out there called RTL that will allow you to do this with regular or Dtext, but I will not work with Mtext.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Intersection Between Line And Circle

Dec 12, 2002

I was looking for a post on the subject of line and circle intersections and found one that Bill Z had posted. I decided to incorperate one of the replies into my own code. In particular Luis Esquivel's code. With some minor modifications I was able to add the onseg argument that extends intersection points for the line to the circle. I also modified it to return only one point or two points depending on the line and circle supplied and the onseg argument. It seems to work great.

; test function
(defun c:go ( / )
(ed_init)
(while
(or
(not (setq ent (entsel "
[code].....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved