AutoCAD Visual LISP / AutoLISP :: Text File With A List Of Image Tile Names
Jun 12, 2013
I have a text file with a list of image tile names with their bottom left hand easting and northing see attached. I have a lisp that asks for the name of the image then should insert the image at its coordinate with a predefined scale and rotation but it isn't working so I would like an alternative method to test.
I am upgrading from 2010 to 2013 and am having a problem with my image tile menu not showing my slides. The dialog box comes up but none of the slides can be viewed. I am using the macro $I=acadbja.GENPLAN1 $I=* Is there an updated command the super cedes this command?
What is the code to call an image tile menu from a lisp command. I currently have a menu item that calls this image tile menu: $I=TYPSMBL1 $I=* but I want to have a keyboard shortcut as well "SL".
We are using a title block and it has an attribute field that links to the file name. Now one of our projects is adding the revision to the CAD file name, but it messes up our drawing sheets.
i.e. It was fine when the CAD file name was 111-A222-ZZ-X-123456.dwg and this would display the complete 111-A222-ZZ-X-123456 in the drawing title.
Now we need to do this, the CAD file name, 111-A222-ZZ-X-123456-001002-A1.dwg and we still need to just show 111-A222-ZZ-X-123456 in the title block, striping away the 001002-A1.
I have a parent directory with x-amount of folders contained inside. I say X-amount because I would like to keep adding or deleting folders as time progresses. I want the folders contained within this parent directory do be read into a lisp variable and then be printed to the command prompt till every folder is displayed by name, then the loop may stop.
Someday the light bulb is going off and I will understand mapcar and lambda. However.....I have a program that reads an excel file sheets. Sometimes the sheet only has 1 column, sometimes 2 or more.
I need to convert the saved values from the sheet to a list with the text spaced evenly. Unfortunately the text lengths vary. I would like a subroutine to pass the list to and return a list of strings with text aligned with padded spaces allowing for the longest text in each column. I am using the new list in a dialog box with fixed_width_font=true (so columns align).
How to write some code which could create variable names like var1, var2, var3, etc. I need to do this because I have a large number to create and the actual number is variable and unknown.
Instead of manually writing a large number of line like
(setq var1 value1) (setq var2 value2) etc
I used to be able to put 1 line in a loop to create and assign a large number of variables. I remember that it involved the use of the set (not setq) and read functions.
What I was thinking of was in a loop some times I need multiple sets of similar variables but am not sure how many sets I am going to need. I would like to be able to increment the variable names each time the loop runs.
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?
I need to change the value of some tags in a title block on multiple drawings. I tried using Lee Macs attribute changer [URL]. It works fine but not when tags have the same name.
I then looked at this code - [URL]
Idea was to change the tag names then use Lee Macs program. It too fails when there are duplicate tag names. It changes all tags not just the one I want.
In the the title block I have 3 tags with the name "NAME" but only one will have the value I'm looking to change. If I could place an IF statement some where in the above codes (or another code altogether) to instruct that IF the tag name is "NAME" with value "Dennis (BSL)" then change either the tag name or the value to "Daniel"
Im pretty bad at this programming stuff but with so many drawings I need a easier, automated way of doing this.
I have 2000+ drawings that have either the layer state "LMAN_DWF" or "DWF". I want all of them to read "DWF" for scripting purposes. LSIP routine that will go into a drawing and change rename a layerstate if it is named incorreclty, but do nothing if it is named correctly?
Does Layer State "DWF" exist?
If Yes, skip file and move on to next file
If No, does Layer State "LMAN_DWF" exist?
if Yes Rename Layer State to "DWF"
If No, skip file and move to next file.
Or a LSIP routine that can simply dump a list of all drawings in a directory that contain "LMAN_DWF" as a layer state. I could then use that list to do a simple script to change the layer state names on those specific files.
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] ......
I have spent the last three days writing a lisp program that will copy a text string from one text file and paste it into another. I have tried using the write-string, getstring, prin1, princ and print functions with no success.
I want to write content of variables to a text file but I should have conversion function for variables.
for example
(setq a 123); a is an integer type, contetnt of a is 123
so I should use (itoa a) to get "123" as a string and then I can write it to text file.
but what about another type of variables?
(defun ToString ( a / result)(setq result "")(cond((= (type a) 'ENAME) (progn (setq result "Entity names")))((= (type a) 'EXRXSUBR) (progn (setq result "External ObjectARX applications")))((= (type a) 'FILE) (progn (setq result "File descriptors")))((= (type a) 'INT) (progn (setq result (itoa
as you know, you can write chars on text screen easily: (write-line (strcat "\U+" "2122"))
but if you want to write chars to a text file, this command does not work: (write-line (strcat "\U+" "2122") TxtFileVar)
Here is a part of my code to test: (defun C:HexGen ( / d f S w x y z h c)(setq d '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F") f (open "c:\0000-FFFF.txt" "w"))(foreach w d (foreach x d (foreach y d (progn (setq S "") (foreach z d (progn (setq h (strcat w x y z)) (setq c (strcat "\U+" h));;;<===character (setq S (strcat S " " (strcat h " = " c ))) ) ) (write-line S f) ) ) )) (close f)(startapp "notepad" "c:\0000-FFFF.txt"))
I'm looking for a way to find out what all plot styles are set in drawings in a sheet set.
We are transitioning from color based pen settings to style based and would like to be able to export a log that shows the variable PSTYLEMODE for each drawing in a sheet set. I plan on using ScriptPro to run it on the full sheet set.
Civil 3D 2013 Windows 7 64-bit Xeon W3550 3.07 GHz Nvidia Quadro 4000 12.0 GB RAM
Run TIME command and then take the resulting text and save it to a file.
Ideally, the text file should be named based on the drawing name. I know there's ways to write text to a file but I haven't had any luck taking the output of a command and exporting it.
how to append I’m assuming its not write-line but append line. And also I’m having trouble recording the date variable… I keep getting error bad argument type stringp nil
; Appends usage count by DATE long variable...(setq g(open "C:/ICT/AutoCAD_Architecture_suite_2012/CUSTOM/WOOD Clones/PEN/USSAGELOG.PEN" "w"))(setq MYDATE DATE)(write-line MYDATE g); AS ABSOLUTE LAST WE NEED TO CLOSE THE TEXTFILE...(close g)
I have the following code snippet I’m trying to append the file named USAGELOG.TXT to record the date of executions
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))
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.