AutoCAD Visual LISP / AutoLISP :: Select Entity With Options To Type In Text / Pick Point
Nov 6, 2013
I am looking for some code that would allow me to select a MTEXT Entity - or other entity - (as the DEFAULT option) but also to allow me to type in some text manually or to pick a point in the drawing. Something that would present the user with:
"Select an object or [P to pick a point]" or
"Select MTEXT or [M to type].
I can write some code to type in text manually as the default option and get the second option to select entity using get string and then write some condition of if code but I don't know how to do it having entsel as default option.
View 3 Replies
ADVERTISEMENT
Jan 31, 2013
I'm wondering if there is a lisp possible to measure area's by pick point (as in bpoly). This little feature exists in Microstation so i was looking for something similar.
Is it also possible if this lisp can measure areas from an external reference (dwg, dxf, dgn, shp etc..)? I'm kind of new to AutoCAD in that sence.
View 2 Replies
View Related
Sep 15, 2011
I need to let the user pick on an entity to get an elevation.
I was using getpoint, with osmode set to nearest, but it allows them to pick 2d items under the 3d items I want picked.
Without doing fancy laer manipulation to turn off 2d stuff, are there any tricks to avoid snapping on the 2d item?
I am thinking I might do an entselp, then try again at same point until i get a 3d one (non 0.0 z coord).
[URL]
View 7 Replies
View Related
Nov 29, 2012
Is it possible to include a point entity (rather than a zero-length line as in the standard SQDOTS pattern) in a custom hatch pattern?
If so what's the exact format of the line in the .pat file that defines the point?
View 9 Replies
View Related
Aug 4, 2011
know if there is a command which joins GetEnttiy() and GetPoint() functions. At the moment I'm using both commands one after another. Result I want would be one command where you can choose entity or select insertion point.
View 6 Replies
View Related
May 8, 2013
I have a lisp routine that I would like to add to. Right now when running the macro the user is not prompted to "Pick Point On Line" in this example
(command "insert" blk "s" var1 pause pause))
I have added the line
(setq pt1 (entsel "Pick Point On Line "))
(command "insert" blk pt1 "s" var1 pause pause))
but the command doesn't seem to like my PT1 value
BLK and VAR1 are set in another lisp routine.
View 9 Replies
View Related
Apr 29, 2012
how to draw a text entity in 3d, where I know the 3d ins point, and the plane it should be flat to.
I have not drawn text or inserted blocks programatically before where the plane they lie on is not flat.
I have done it before by setting a ucs and drawing stuff, but now I want no switches of UCS involved.
[URL]
View 2 Replies
View Related
Dec 29, 2012
I am wanting to use autolisp to access the text in a MTEXT entity. assoc(1) gives me the first bit of text, but not the rest.Is there a way to use assoc to access each of a number of matches or do I need to write my own routine to find all the 1's?
View 5 Replies
View Related
Aug 12, 2013
We have been modifying a trim-around-block routine to have as few clicks as possible and though it feels like we'd be able to have the line to be broken auto-selected based off of the insertionpoint that was set as a variable.
;(setq pnt1 (getvar "lastpoint")
; sst1 (osnap pnt1 "nea")
;end setq
;(setq ss (ssget '((0 . "LWPOLYLINE")))) ; limited to Polylines
; (while (> (sslength ss) 0) ; as long as there's anything in [or remaining in] the selection set))
; (setq ent (ssname ss 0)
; paramcount 1
; ) ; first entity in [or remaining in] the selection set paramcount 1); end setq
are about the closest snippets of code that we've managed to find but neither of these are working.
How we can force the program to break the line without the user having to select the line (because they will have already selected the insertpoint, and using osnap nearest would find the line that requires breaking)
View 9 Replies
View Related
Apr 9, 2012
For a program i am working for i have to extract the base point of a dynamic block.
This can be done perfectly by this function:
(cdr (assoc 10 (entget (car (entsel)))))
But i want the entity selected based on a previous slected point. So for example when i selected pt1 (which is a point at the border of the dynamic block) i want to be able to extract the base point on the block whit this point.
View 8 Replies
View Related
Aug 1, 2013
this code is used to fix specific font but its problem that it will prompt you to select single text
i need to make it to select multiple text so it saves me a lot of time,
;;; Process Individual request
(defun cht_ProcessIndividual ()
(setq sslen (sslength sset))
(while (> sslen 0)
(setq temp (ssname sset (setq sslen (1- sslen))))
[Code]...
View 2 Replies
View Related
Jan 10, 2008
How do I change the insertion point of a text using "vla-put" ? I've tried using :
(vla-put-InsertionPoint en a)) with a = (4455.94 428.576 0.0)
and I get the following error:
lisp value has no coercion to VARIANT with this type: (4455.94 428.576 0.0)
View 9 Replies
View Related
Oct 3, 2013
Code to select node points an/or text that has a Z value greater than "E1" and less than "E2". (where E1 and E2 are user input values)
View 5 Replies
View Related
Jun 8, 2012
Im trying to come up with a lisp that will export x and y coords to a txt or cvs file. However, I need the lisp to export in this format
Units Inch
WPT 1 0 0 ( X=0 Y=0)
WPT 2 1 1 (X=1 Y=1)
WPT 3 2 2
I need to be able to set my zero with move origin and the export the points.
View 9 Replies
View Related
Oct 10, 2013
I have a specific need to determine if an entity is existing or not so that I can either make changes to or create the entity. I'm trying to do this while referring to the entity by it's handle. Below is my code this far but it doesn't work.
(IF (AND (SETQ HNDL (VLAX-LDATA-GET "TB" (STRCAT PLN "PLAN"))) (NOT (VLAX-ERASED-P (VLAX-ENAME->VLA-OBJECT (HANDENT HNDL)))) ) (PROGN ;;| DO SOMETHING WITH THE EXISTING ENTITY ) (PROGN ;;| MAKE THE ENTITY
(vlax-ldata-put "TB" (strcat PLN "PLAN") (CDR (ASSOC 5 (entget (entlast))))) ))
I ran the program and the handle was stored, then I deleted the entity and ran the code again and this is the error I get:
; error: unable to get ObjectID: nil
This VLISP stuff sometime has unpredictable hoops to jump through first, so I wondering if this is the case here.
View 3 Replies
View Related
Mar 29, 2012
How can i build a selection set of all circles and then retrieve the xdata attached to them?
View 9 Replies
View Related
Aug 19, 2013
How do I get the angle of an Mvblock/wall or any other ADT entity to use in a lisp routine to set Snapang?
View 4 Replies
View Related
Apr 23, 2012
I am trying to select multiple instances of text (dtext) with different strings but want to change all of the fomats to the same settngs. I have searched high and low on the web to no avail. I am using AutoCAD 2012.
For example: I want the routine to find all instances of "AA", "AB", "AC", "AD", "BA", "BB", "BC", "BD", etc... all the way up to "ZD".
Next I want all of those text entities to change to the following text formats:
Text Style = STANDARD_96Layer = F-ANNO-CKTText Justification = MIDDLE CENTERText Width = .8
Getting this to work with just finding one string at a time with the ssget function seems simple enough, but it's getting it to work with multiple strings that I can't get past.
View 8 Replies
View Related
Aug 17, 2012
i found this valuable script Lisp routine to insert blocks at point locations and want to modify it but i do not know much about lisp ...
what i want is :
1) script start and asks for a Block Name (in this case QPP1, QPP2, QS, QE, ect)
2) the user picks existing text
3) the script reads the value existing on this text an put it in a variable
4) then erases the pre picked text
5) inserts the block chosen
6) changes block value to number value pre-read
since it do almost all steps except for step 3 and 6
View 4 Replies
View Related
Nov 16, 2012
Is there a way to modify the text insertion point of multileaders using lisp? We have a problem with some of our multileaders getting a landing distance set to a negative value. My lisp routine will correct these to a default value, but then the text jumps a bit. If I could get the insertion point prior to changing the landing distance then I could restore that point after changing the landing distance.
;;-------------------------------------------------------------------------------------------------(defun c:zld (/ e th dogleg doglegllength sf ss c mlss mlcount) (setqss (ssget (ssget "X" (list (cons 0 "MULTILEADER"))))DWATxtHgt (getvar "userr1")sf 1dogleg (/ 3 32.0)th (if dwatxthgt dwatxthgt dogleg)c 0mlcount 0mlss (ssadd)) (IF ss (while (< c (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss c)) c (1+ c) ) (= (vla-get-ObjectName e) "AcDbMLeader") (progn;;change the dogleglength if
[code].......
View 7 Replies
View Related
Aug 8, 2013
I know how to increment pick points numerically (see below). How is it done alphabetically?
(defun C:test (/ pt# pt) (setq pt# (getint "
Enter number: ")) (while (setq pt (getpoint "
Specify point: " ))(if (/= pt nil) (progn (command "TEXT" "M" pt "" "" pt#) (setq pt# (1+ pt#)) ) ) ) (princ))
View 3 Replies
View Related
Jul 30, 2013
I used to have a lisp routine that would allow me to pick one dynamic block and it would select all instances including the blocks that have become anonymous.
View 5 Replies
View Related
Nov 18, 2013
I like that Autodesk now allows us to just pick a command's option from the command line instead of typing a letter in the option. For example, when drawing a rectangle we're prompted to "Specify first corner point or [Chamfer Elecation Fillet Thickness Width]" and if we wanted to draw fillets on the rectangle we can simply PICK that option from the prompt in the command line OR enter an "F" and return.
Is there a way we can use this functionality in our custom programs?
View 9 Replies
View Related
Jul 13, 2011
finding each objects Position XYZ and Rotation XYZ using LISP. It looks like position is a pretty easy one but rotation data is a bit elusive.
View 9 Replies
View Related
Feb 27, 2012
When we launch the list command, the Area system variable holds the area value of the selected shape.
How to get the length value into an Autolisp program to use it?
View 3 Replies
View Related
Aug 23, 2011
how to make a toolbar button so that when i click it and select a few single text, it will automatically change the text base point to be at "MIDDLE CENTER"....
At the moment, i use to create a button with macro of " ^C^C_text;j;mc "....But the problem is whenever i use this button, i still need to type "MC" at the command prompt.. How to make it so that after i click the button, all i need to to is just select the text..
View 9 Replies
View Related
Aug 25, 2005
Is there a tool out there that will allow me to pick an object and change it's layer properties?
View 9 Replies
View Related
Aug 17, 2011
Normally when applying the matchprop command in CAD, one has to first pick the template element, and then select the elements which should have this template element's properties copied to/matched.
is it possible (via lisp perhaps?) to reverse this order, so that i can select a bunch of elements (e.g. through the quickselect icon) and THEN apply a matchpropertieslisp command, then select a single template element which the initially selected elements should mimic?
View 4 Replies
View Related
Nov 13, 2013
presuming I have a selection set of different entities, that might have different linewight.
The code that is responsible for this property is 370
370Lineweight enum value. Stored and moved around as a 16-bit integer.not omitted from here
I need to make all of the entities have the same layer, and to make sure the each entity has the "ByLayer" lineweight.
The problem that I encountered, is the lineweight changement.
This is the colution that I came with, but it doesn't work for me:
(defun c:test () (setq en (car (entsel))) (setq el (entget en)) (setq el1 '()) (setq indx -1) (repeat (length el) (setq indx (1+ indx)) (if (/= (nth indx el) (assoc 370 el)) (setq el1 (cons (nth indx el) el1)) ) ) (setq el el1) (entmod el) (princ) )
Having tested it in different ways, it looks like at the end, el1 represents the association list that I want my object to have, but it doesn't want to update.
View 9 Replies
View Related
Oct 8, 2013
I need to return the entity name of the largest (longest closed) polyline in a selection set. At this point I have no trouble creating the selection set and even getting the area of the boundingbox, which is not the most accurate way to find the true size, but it's a start. The part that has me stumped is: if I iterate through the selection set, then how can I compare one to the other when I have access to the current entity. I've been staring at examples of lambdas but it seems to me that iterating through the selection set is going about it wrong in the first place.
Below is my current code with a remaining issue. I can return the largest area of the polylines (no good for more than two entities in selection set), but I do not know how to return the entity name:
(IF (> (SETQ SS (SSGET "x" '((0 . "*POLYLINE") (8 . "POOL") (-4 . "<OR") (62 . 5) (62 . 256) (-4 . "OR>")))) 1 ) (PROGN (SETQ a (1- a) ent (CDR (CAR (SSNAME ss a))) en2 (CDR (CAR (SSNAME ss (1- a)))) ar1 (APPLY '* (LIST (LAMBDA (ent) (VLAX-INVOKE-METHOD (VLAX-ENAME->VLA-OBJECT ent) 'getboundingbox 'minpt 'maxpt) (SETQ pt1 [code]......
View 9 Replies
View Related
Apr 30, 2012
I use extended data on 2d entity in AutoCAD 2010. In a lisp program, I have filtered with extended data selection. Filters work with entity like: line, polyline and Mline but with insert entity it don’t work.
The end get result for a block :
((-1 . <Nom d'entité: 7ffffbe7d90>) (0 . "INSERT") (330 . <Nom d'entité: 7ffffb039f0>) (5 . "18CA91") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Fam_POTEAU_ROND_INSERT_021") (100 . "AcDbBlockReference") (2 . "POTEAU_ROND") (10 155239.0 -100209.0 0.0) (41 . 16.05) (42 . 16.05) (43 . 16.05) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0) (-3 ("CREEMET000" (1000 . "Fam021") (1040 . -14.0) (1040 . 434.0) (1071 . 0)) ("CREEMET001" (1071 . 2) (1071 . 3) (1071 . 0)) ("CREEMET014" (1000 . "Poteau rond mixte (a completer)")) ("CREEMET002" (1000 . "_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_-1_-1_-1"))))
The filter list use :
((-4 . "<OR") (2 . "POTEAU_ROND*") (-4 . "OR>") (-3 ("CREEMET002" (1000 . "_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_-1_-1_-1"))))
View 3 Replies
View Related