AutoCAD Visual LISP / AutoLISP :: Retrieving Entry From Entity Association List

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


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Retrieving Xdata From An Entity?

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

AutoCAD Visual LISP / AutoLISP :: How To Sort Association List

Jun 14, 2013

How can I sort  an association list?

for example:
(setq lst '((1 . "s") (12 . "t") (-7 . "u") (0 . "v")))
 should be sorted as:
((-7 . "u") (0 . "v") (1 . "s") (12 . "t"))
 { sort on: (car(assoc index lst)) value}

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Build Association list With Nested Association Lists

Sep 27, 2013

I need to build an association list with nested association lists.

Here is my current
(IF (SETQ SUBLST (ASSOC CATEGORY PLNTLST))(PROGN (SETQ PLNTS (CONS PLANTNAME (LIST(CONS 'SIZE (dict-get PLANTNAME "SIZE"))(CONS 'COLOR (dict-get PLANTNAME "COLOR"))(CONS 'QTY (dict-get CATEGORY PLANTNAME))) ) PLNTLST (cons PLNTS SUBLST) ))(SETQ PLNTS (CONS PLANTNAME (LIST (CONS 'SIZE (dict-get PLANTNAME "SIZE")) (CONS 'COLOR (dict-get PLANTNAME "COLOR")) (CONS 'QTY (dict-get CATEGORY PLANTNAME)) ))PLNTLST (CONS CATEGORY PLNTS)))
[code]....

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Confirming Entry With Pop-up List In DCL?

Aug 15, 2011

How can I determine what was selected in the pop-up box and then using that for 1 of 2 things, either 1) Turn off the Edit Box for Hole Spacing if the selected option is 1(which would be value = "0" of the popup list) or 2) Making the portion where it confirms that the Hole Spacing Edit Box is filled out so that if the Pop-up List displays 1, it doesn't check the Hole Spacing Box. Below is the DCL and LISP that I'm currently using.

Here is my current DCL:
questions :dialog {label = "Information for Program";: row {: column {: boxed_radio_row {key = "Galv";label = "Galv Slot Required?";: radio_button {key = "Y"; label = "Yes"; value = "1";}: radio_button {key = "N"; label = "No";}}: boxed_radio_row {key = "Bevel";label = "Is Leg to Face

[Code].....

If needed: AutoCAD 2013 User using Visual LISP for editing LISP and DCL files Also I have AutoCAD 2011 currently still available for us, but we are using AutoCAD 2013 for 99.9% of AutoCAD use

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Extended Data On 2D Entity - Filter List

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

AutoCAD Visual LISP / AutoLISP :: Function To Print Out Entire List Of Selected Entity?

Oct 28, 2011

I am looking for a function to print out the entire entity list of the selected entity...

so... walking down through the entity data... print out what it finds... any time it encounters an entity name... then do an entget and print that out too.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving ActiveX Selection Set

Feb 7, 2013

Tried retrieving an ActiveX selection set in AutoCAD 2013 (AutoCAD Architecture 64bit on Windows 7 is what I am using)?

Using a piece of LISP I got from the ADN developer site, it no longer works and gives this error....

Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

(defun c:erset (/ acApp acDoc selSets ss1)
(vl-load-com)
(setq acApp (vlax-get-acad-object))
(setq acDoc (vla-get-activeDocument acApp))
(setq selSets (vla-get-SelectionSets acDoc))
[code].....  

Unfortunately my lisp is very basic.

(defun c:getSset()
(vl-load-com)
(setq ss-vba (vla-item
(vla-get-selectionsets
(vla-get-activedocument
[code]......

What about creating an AutoLisp selection set from .NET - is it possible, if so I would prefer to do that instead?

The goal is to create some objects in .NET (using activeX or managed code) and then have some way to access these objects via the command line I'm assuming they only way is using an AutoLISP selection set.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Current Paper Text Height

Oct 10, 2012

I'm looking for code to retrieve the "Paper Text Height" from the current (active) "Text Style".

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Number Of Entities In Dynamic Block

May 19, 2013

I am modifying stuff in a dynamic block insert entity. There is no "endblk" entity at the end of these definitions and I need to cycle through every entity within the block definition. When it gets to the last entity,  I get an error because you cannot entnext passed the last entity. There are 2 things:

1. How to retrieve the # of entities in a block without cycling through it.
Or
2. A quick lesson in the *error* function, I cannot figure out how to implement this. I basically want to to say:

(if (entnext myent)) returns a error, don't abort & continue on.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Determine Existence Of Entity

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

AutoCAD Visual LISP / AutoLISP :: How To Draw Text Entity In 3D

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

AutoCAD Visual LISP / AutoLISP :: Snapang Within MVBlocks / ADT Entity

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

AutoCAD Visual LISP / AutoLISP :: Length From Both Side By Digit Entry?

Sep 5, 2012

i need any lisp that perform the Lengthen command from both side of Polyline by Digits Entry.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Access Text In MTEXT Entity

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

AutoCAD Visual LISP / AutoLISP :: Find Position XYZ And Rotation XYZ Of Each Entity?

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

AutoCAD Visual LISP / AutoLISP :: Get Point On Entity But Ignore Ones At 0.0 Elevation

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

AutoCAD Visual LISP / AutoLISP :: Point Entity In A Hatch Pattern

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

AutoCAD Visual LISP / AutoLISP :: How To Retrieve Length Value Of Single Entity

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

AutoCAD Visual LISP / AutoLISP :: Changing Layer Settings From A Sheet Set Entry

Sep 26, 2013

for my latest little project I'm trying to change layer settings depending on a entry in a sheet set attribute.

Basically, if the sheet set custom attribute entry is 'white' I want the colour of a specific layer displayed as 255,255,255, and if it's blue I want it changed to 0,0,255. So I can control the colours from a sheet set custom properties level.

And for it to check if the layer existing in the drawing, so it'll skip the process if it's not there.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Return Entity Name Largest Polyline Of A Selection Set

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

AutoCAD Visual LISP / AutoLISP :: Extended Entity Data Lost In Files

Jan 2, 2013

Just recently I have noticed a Major problem occurring with Xdata.  My programs that i use XDATA storage in work fine until you save the drawing.  When you call the file back up the Xdata is gone the only thing in the xdata is NameSpace value.  Is this related somehow to a Windows update?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete Vertex From 3D Pline Without Making New Entity?

Dec 6, 2007

I have a program that makes 3d polylines from various data. That 3d pline then gets added to a civil 3d surface as a breakline. I want to modify the pline with my program, but preserve the handle, as I think that is what C3D uses to decide if its part of the surface. I tried this as a sample with no luck:

;DELETE 3RD VERTEXT FROM 3D PLINE
(DEFUN C:T3 ( / EN ENAME ENT ENTL)
;GET 3D PLINE
(SETQ ENT (ENTSEL "
Select 3D Pline:")

[Code] .....

I know you can modify a vertex, but what about add and delete with entmake and entmod? I also considered using activex for this task, but you can only add verticies from what I could tell in the object browser of VBA, not delete them.

What I will be doing is deleting all the verticies and adding back the correct ones. Or if there was a way to transfer a handle to a new entity after deleting the old, that would suffice too.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getstring / Getint Digits / Characters Entry Limit?

Aug 26, 2013

I have been searching all over and have not found a method for limiting the number of digits/characters a user can enter for a getstring or getint prompt.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Color And Linetype Of Xref Nested Entity

Aug 22, 2012

I have a Lisp that I have been working on with some folks in the office, and i feel like i am close, but i am not getting the cigar. The idea would be to have the lisp allow the user to select a nested x-ref entity, and change the color and linetype of the selected layer, similar to the old "LAP" command (I know it is a dinosaur, but I still miss it). I seem to be doing swimmingly, code I have quasi-plagiarized. It seems to crap out where i try to pass the selected linetype back to the layer. I get the nastygram "Command: ; error: no function definition: GETLINETYPE" right after selecting the linetype from the dialog.

Code below...

x(defun c:CX (/ Sel EntList DataList cnt Num ClrNum EntData)
(if (setq Sel (nentsel "
Select object to change layers color and linetype: "))
(progn

[Code]...

HP Elitebook Workstation
Windows 7

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Block Name Of Anonymous Block

Mar 8, 2013

When dynamic blocks are inserted they're assigned an anonymous block name.  I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.

Need a bit of code that handles this?

View 3 Replies View Related

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 View Related

AutoCAD Visual LISP / AutoLISP :: Add List To A List

Jul 15, 2013

I have a list -

(setq List1 (list "Line A" "Line B" "Line C"))

I would like to add each item in an existing list to a new list -

(setq ListNew (list "This is some text" "This is more text"

the following is the part I can't figure out - it just adds the list to the list, not the individual items

(mapcar '(lambda (x) x) List1)))

I am looking for ListNew to be - (a list with 5 strings)

"This is some text"

"This is more text"

"Line A"

"Line B"

"Line C"

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add String To Each Item In List Using Lisp

Nov 14, 2013

I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg").  how would i go about doing that using LISP?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Existing Text To Keyboard Entry Text

Jun 21, 2012

I have two attributes "REVN" and "REVD" in a block "ATT" that I would like to change (globally preferably) to the following.

(1) Existing text to keyboard entry text.

(2) Colour from existing to 10

I am a bit lost in the (command "-attdef" .......)

(defun c:atc ()
(setq rev (getstring "Please enter review"))
 (setq dat (getstring "please enter date"))
 (command "-attdef" .."ATT".."REVN"....."c" "10")..)
 (command "-attdef" .."ATT".."REVD"....."c" "10")..)

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Entmake A Hatch Entity From A Hatch Template?

May 2, 2013

I am trying to entmake a hatch entity from a hatch template.

After entget the template hatch entity, i get the followings

Select object: ((-1 . <Entity name: 7ed11b78>) (0 . "HATCH") (330 . <Entity
name: 7efc7c10>) (5 . "737") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"SECTION-LABEL") (62 . 255) (100 . "AcDbHatch") (10 0.0 0.0 0.0) (210 0.0 0.0
1.0) (2 . "SOLID") (70 . 1) (71 . 0) (91 . 1) (92 . 1) (93 . 8) (72 . 1) (10
633596.0 5.79713e+006 0.0) (11 633519.0 5.79713e+006 0.0) (72 . 1) (10 633519.0
5.79713e+006 0.0) (11 633519.0 5.79708e+006 0.0) (72 . 1) (10 633519.0
5.79708e+006 0.0) (11 633500.0 5.79708e+006 0.0) (72 . 1) (10 633500.0

[code]....

Now I  wrote the following code using the above data as follows

(entmake (list (cons 0 "HATCH") (cons 67 0) (cons 410 "Model") (cons 8 "SECTION-LABEL") (cons 62 255) (cons 10 (list 0.0 0.0 0.0)) (cons 210 (list 0.0 0.0 1.0)) (cons 2 "SOLID") (cons 70 1) (cons 71 0) (cons 91 1) (cons 92 1) (cons 93 8) (cons 72 1) (cons 10 pt1) (cons 11 pt2) (cons 72 1) (cons 10 pt2) (cons 11 pt3) (cons 72 1) (cons 10 pt3) (cons 11 pt4) (cons 72 1) (cons 10 pt4) (cons 11 pt5) (cons 72 1) (cons 10 pt5) (cons 11 pt6) (cons 72 1) (cons 10 pt6) (cons 11 pt7) (cons 72 1) (cons 10 pt7) (cons 11 pt8) (cons 72 1) (cons 10 pt8) (cons 11 pt1) (cons 97 0) (cons 75 0) (cons 76 1) (cons 98 1) (cons 10 (list 0.0 0.0 0.0)) (cons 450 0) (cons 451 0) (cons 460 0.0) (cons 461 0.0) (cons 452 1) (cons 462 1.0) (cons 453 2) (cons 463 0.0) (cons 63 5) (cons 421 255) (cons 463 1.0) (cons 63 7) (cons 470 "LINEAR")))

The point variables pt1, pt2....pt8 are all defined. But when I run the code the hatch is not being created? Why?

View 1 Replies View Related







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