AutoCAD Visual LISP / AutoLISP :: Combining Two Dotted Pairs Into A List Of Dotted Pairs
Jul 17, 2013
I am trying to add dotted pairs to a list of dotted pairs one at a time in a loop, but I cannot get through one iteration.
The pseudo code is basically
(while (/= nil readline) (if = 0 count (setq 0list (cons 8 readline f))
(count = count + 1) (else (setq 0list (append 0list (cons 8 readline f)))
(count = count + 1)
)
)
The program gets the layer name from a text file and makes a dotted pair out it. When it iterates for the first time it puts the dotted pair into 0list. When it iterates the second time I want it to take the next line make a dotted pair and append 0list.
I keep getting error:bad list and I am assuming it is because it is trying to append 0list which only has one dotted pair in it and is technically not a list. I am not sure.
I have like three different versions of the same code I have tried. Any way to read a layer name from a file make a dotted pair and add the dotted pairs to a list of dotted pairs one at a time that would be amazing.
I get the reading and making a dotted pair part. I just can't get the dotted pairs to add to a master list.
View 9 Replies
ADVERTISEMENT
Apr 2, 2012
So what I'm trying to do is make a selection set that will only select a specific dimension, as I don't know the exact placement as it varies depending on the size of the part. I know what the value will be, but again the value depends on the size of the part, but one of the items earlier in my program is I get the Hole Spacing, which the dimension I need to select is Half of the Hole Spacing. Here is what I'm trying:
(setq HALFBOLTSPCDXF '((1 . HALFBOLTSPC)))
where HALFBOLTSPC is a variable that takes the Bolt Spacing and divides it by 2.
When I do a run selection in Visual LISP, I get the following:
((1 . HALFBOLTSPC))
But what I was expecting to get was:
((1 . "10.00""))
As my test case is using 20" Hole Spacing which means half the hole spacing is 10.00". So is there another way to do this? OR what do I need to do to get it to recognize the Variable and give the value instead of the Variable name?
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
Oct 17, 2012
I am using entmake to create a line but I want the transparency to be a percentage. I know that the (440 . xxxxxx) dotted pair controls transparency. I don't understand the number that has to be used with 440. What numbers to put in for different transparencies?
View 9 Replies
View Related
Oct 2, 2013
I have a list of dotted pairs and some of the entries are paired with a deeper list others contain mostly string data. the issue is that I need to print the data to the command line with a newline to seperate them. So I want the output to look like:
;from(customer (city . "Mesa")(zip . "85213")(project (scope (demo . "some description")(construction . "some description")) (cost (subtotal . "some subtotal") (total . "some total"))));tocity Mesazip 85213demo some descriptionconstruction some descriptionsubtotal some subtotaltotal some total
I can print the entire list easily with:
(FOREACH IDX (CDR (VLAX-LDATA-GET "JobData" "LIST")) (PRINC "
") (PRINC IDX) (PRINC "
"))
But, the issue is that when the data is a list it print it out to a single line making it very difficult to read. I tried adding another FOREACH into the loop that I had hoped would iterate through the deeper list and print those lines out in a simular fashion but I only get an "error: bad argument type: consp " and it displays the first element of my list.
I tried to evaluate the IDX and check the type, so that if it is a list then it triggers the deeper FOREACH but it seems I did it wrongly.
View 9 Replies
View Related
Sep 15, 2004
is PS 7 able to do dotted lines and circles? If I create a selection (circle or rectangle) can it render dotted lines?
View 2 Replies
View Related
Jun 7, 2012
I'm working on a program that requires me to analyze a series of 3D coordinates (which describe the start and end points of individual lines) and combine those points that are collinear (there are lots of smaller line segments, some of which are co-linear and overlapping in space) into one single line.
how to analyze these points to find out which ones can be combined. For example, I might have 6 lines, 3 are separate and have their own specific orientation, but 3 are overlapping and in the same direction (look as a single line on the screen). I'd like to modify my point list so that it describes 4 lines... (the 3 individual ones and one which combines the 3 overlapping lines).
View 1 Replies
View Related
Feb 5, 2014
I haven't changed my preferences or upgraded the software, but suddenly my "ci"s are changing to "a"s with a tilde over them, and my "ek"s are changing to "fi" ligatures. I've looked in my preferences and settings and cannot see where to control this.
View 5 Replies
View Related
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
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
Aug 17, 2012
I have a list that contains data like this,
"Tree-01-08-AA5"
"Tree-04-12-QV"
"Tree-10-30-QS"
How would I go about sorting this list by AA5, QV, QS? I know how to use vl-sort and reverse, but I do not understand how I would go about this.
View 9 Replies
View Related
Aug 26, 2012
I have a list like ("a.dwg" "b.dwg" "c.dwg") and an filename "b.dwg"
I want to know if the file name is a part of the list. which function must be used for this?
View 5 Replies
View Related
Oct 13, 2013
I need to modify the code below.
When I run the command and write the scale, I need to change the name of the scale and the ratio automatically. The ratio should always be in the format "1: #", also the name of the scale. Maybe assigning more variables with "setq", I do not know.
(defun c:test ()(setvar "cmdecho" 0)(setq name (getint "
Type the scale you need:"))(setq ratio (strcat "1:" "0.1"))(command "-SCALELISTEDIT" "Add" name ratio "Exit")(setvar "cmdecho" 1)(princ))
View 6 Replies
View Related
Jul 11, 2013
Here's one that I could use on that i can't figure out:
I have a list of a bunch of descriptions that looks like this:
("00.02.00" "CTD01 Mainframe PT1 (top)" "GD01")
What I am doing is grabbing the middle item and i need to break this up into 2 lines. So, my code below grabs the first 3 "words" in the second item in the list and puts them in a list, but I need to convert this back to a string.
(setq desc6a (list (car (read (strcat "(" (cadr input6) ")" )))(cadr (read (strcat "(" (cadr input6) ")" ))) (caddr (read (strcat "(" (cadr input6) ")" )))))
I tried a bunch of ways but can't get it
View 8 Replies
View Related
Apr 25, 2013
I've been experimenting with lists and I'm curious about the fastest / easiest way to get the next element from a list:
Currently my best shot is to wrap (member 2 '(1 2 3)) with: (car(cdr (member 2 '(1 2 3))))
View 9 Replies
View Related
Jan 6, 2012
How to export to a txt file a list containg all the objects on the current layer and their properties?
To be precise, I would like to export the following items from a selection of plines:
- ObjectID;
- Start Point;
- End Point;
- Vertex Points;
- Width.
View 3 Replies
View Related
Jul 17, 2012
Here is the code snippet from my program, I am trying to build a associative list from two regular lists in the while loop. Does ""append " or "cons" only work for simple lists? Given attributeNameList attributeValTypeList which are always of the same length
(setq listCntr 0)
(while (<= listCntr (length attributeNameList))
(setq attrTagTypeAssnList (append attrTagTypeAssnList (list ((nth listCntr attributeNameList) (nth listCntr attributeValTypeList))) ))
(setq listCntr (1+ listCntr)
)
How can I dynamically build the association list.
View 2 Replies
View Related
Sep 17, 2013
I've created a list and want to subtract all the values within it from another variable, and assign it to a new variable. How do I do it?
Basically, I ask for ground level (assigned to variable G1), and then any number of depths beneath that (assign to list LVLLIST), and I want to return the value of the bottom point. So it's all the values in LVLLIST added together and subtracted from G1. And assign it to a new variable BASE.
For example,
G1 = 650.00
LVLLIST = (1.23 23.26 0.13 50.23)
(setq BASE (- G1 LVLLLIST))
View 2 Replies
View Related
Oct 7, 2011
In the example given I have two instances to show how unique the information can be.
I would like the left column of words to be some type of drop down or list so that the user does not have to type these for each line. I don't care if it's attribute, text, mtext, just whatever gets it done.
View 6 Replies
View Related
Jun 11, 2013
I want to list all of loaded lisp programs in AutoCAD (both .lsp and .fas) It's easy for .ARX files: (vlax-safearray->list (vlax-variant-value (vlax-invoke-method (vlax-get-acad-object) 'listarx)))
View 9 Replies
View Related
Dec 5, 2012
I have the following string of code, that I'll write in everyone's start-up suite. I'm able to retrieve a list of files I want to modify, for whatever reason. (One example, when plotting drawings with layouts, sometimes the shadeplot setting is wireframe, and not classic hidden, though it's been set up in our templates).
The huge question is, can I get a list of drawings to a variable in one drawing, and have access to that variable list, in the next drawing I open? I'll iron out the bugs on read-only statuses, or manipulating drawing states later.
(defun GetDrawings ()
(setq currentpath (getvar "dwgprefix"))
(command "pspace")
(setq DrawingList (dos_getfilem "Select a file" currentpath "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"))
(setq ListOfDrawings (cdr DrawingList))
(setq DrawingPath (nth 0 DrawingList))
[code]...
View 1 Replies
View Related
Dec 11, 2013
I want to make a list of layers due to their index (order) in the "layers combo box" in the AutoCAD. I prepared this:
(defun c:ListLayers ( / a b)(setq a(list(cdr(assoc 2(tblnext "layer" T)))))(while(setq b(tblnext "layer")) (setq a(append a(list(cdr(assoc 2 b))))));while);end
But, It's not match with the order of layers.
View 9 Replies
View Related
Feb 3, 2012
I'm looking for a lisp routine that will globally list all the values from a specific attribute tag within a specific block. The attribute tag is "COMMENT" and the block name is "FSD".
View 9 Replies
View Related
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
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
Feb 12, 2011
Searched NG and did not find anything.
Given a list remove from list if both (nth 0) and (nth 5) are duplicates in list
(setq dolist '
(("CABLE, MIL-C-24640/18D " "IAF" "A/R" "FT" "6145-01-224-9183" "-" "3XSOW-7" "C-LC(1), (2)")
[Code]....
View 9 Replies
View Related
Oct 31, 2013
I am unsure why my Lisp does not work.
(DEFUN C:Clear_values (/ GLBLS) (SETQGLBLS '(*DATEDRAWN* *DRAFTNAME* *JOBNUMBER* *OWNERNAME**JOBCOE* *PERMITREVDATE* *PERMITCONTACT* *HOMEBUILDER**SUBDIVISION* *ADDRESS**CITY* *STATE* *ZIP* *LOT#**PARCEL#* *NSCOORD* *EWCOORD* *STANDARDDETAIL#**SUPERNAME* *SALESMAN**GATECODE* *HOMEPHONE* *WORKPHONE* *ALTPHONE1**ALTPHONE2* *EMAIL1* *EMAIL2* *ACCESS**EXCAVATIONTYP* *EXCATDEMO1**EXCATDEMO2* *SKIMRUN* *AWLRUN*
[code]....
I've tried several options such as (mapcar 'set GLBLS "%%") but nothing happens, and with the above code nothing happens; the code only returns nil.
View 8 Replies
View Related
Aug 16, 2013
I'm making a program that reads a property file that follows the format:
"key=value" for each line on the text file.
One specific line has the key "file" and the value is some file path that includes a space.file=C:/my folder/my file.txt
Now I can extract what the key and value is for any given line in the file.However, I want to put all of the data into an Associative List so that I will not need to keep opening the file each time I search for information. I've been using the cons function in order to create a dotted list, which is successful. However I have an issue when I add this dotted list to the end of my associative list.
Suppose I have a key and a value already stored inside variables. Below I have two lines of code, first the dotted list portion is printed, and works as expected. The second line adds that dotted list to the associative list:
(princ "Cons: ")(princ (cons key val)) (princ "") ;Prints (file . C:/my folder/my file.txt)(setq assocList (append assocList (cons key val))) ;Error message here.
The error that I receive says "; error: bad list: "C:/my folder/my file.txt"..Here is the change:
(setq assocList (append assocList (list (cons key val))))
Now, the dotted list is inserted properly and looks like this after printing the whole associative list: ((version . 1.0.1) (file . C:my foldermy file.txt))
View 1 Replies
View Related
Oct 17, 2011
Is it possible to obtain a list of coordinates for view ports (with dxf codes or otherwise) similar to obtaining a list of (assoc 10) for polylines?
I'm aware I can get the center, width and height from the dxf codes, but what about for clipped view ports with irregular shapes?
View 2 Replies
View Related
Dec 20, 2011
how to work with safearrays so that I can modify a dynamic block property reporting tool that I found here on the forums. I’d like to take the following code and filter out the extraneous properties so that the user doesn’t get information overload. Here’s the code that I'm starting with – works nicely:
(defun c:dbinfo (/ obj v vval sal salnth count)
(setq obj (vlax-ename->vla-object (car (entsel "
Select Dynamic Block: "))))
(setq v (vla-getdynamicblockproperties obj))
(setq vval (vlax-variant-value v))
[code]....
So, how do I filter the safearray list (down two levels to property names) so I can remove origins and other unimportant properties? Here’s the two property names I am trying to filter out:
(or (= (car y) "Origin") (= (substr (car y) 1 8) "Position"))
I’m beating my head against the wall trying to figure out how to take sal and redefine it like:
(/= (or (= (car y) "Origin") (= (substr (car y) 1 8) "Position")))
Of course, that doesn't work with a safearray.
View 6 Replies
View Related
Aug 16, 2013
I found a function on JTBWorld named listPageSetups, which appears to be meant for listing the pagesetups that exist in an "open" dwg file (as I can get it work for the current dwg). So,
(1) Can this function be used to list page setups in another, un-opened dwg, and, if so, how?
(2) If the answer to (1) is No, is there a LISP way to get a list of page setups from another, un-opened dwg?
View 9 Replies
View Related
Jul 30, 2012
where I can obtain a freeware lisp routine that lists the lengths of all the polylines on a specific layer or within a selection set? I want to avoid list if possible as there are rather a lot of polylines!
View 2 Replies
View Related