AutoCAD Visual LISP / AutoLISP :: Extract A Folder Name Within Dwgprefix
Aug 17, 2012
I’m looking to extract the second from the last directory within the dwgprefix of
"P:Projects66 Structural666-4800-00 TPA666-4815-00 Res4815 Res Figures" (i.e. 666-4815-00 Res)
This is what I have so far:
(defun c:tmp ( )
(setq P1 (getpoint "
Pick point: "))
(command "text" P1 "" ""
(strcat
(vl-filename-base
(vl-string-subst "." "\" (getvar 'dwgprefix) (vl-string-position (ascii "\") (getvar 'dwgprefix) nil T))
))))
View 9 Replies
ADVERTISEMENT
Jun 4, 2013
I need a lisp routine that will allow me to pick a polyline and label with azimuth and distance (direction-north, clockwise) of a new WCS.
Is there any code that extract information for a new WCS?
View 9 Replies
View Related
Nov 25, 2013
I have a drawing that has an aerial Images inserted into it using a WMS Connection How to extract Image Name through Autolisp from this
View 5 Replies
View Related
Oct 6, 2011
I am trying to write a lisp file that extracts the LAYER, Z, X, Y, TEXT HEIGHT, POINT NUMBER, from the attached DXF file. Ultimately I will have the lisp insert a "POINT" at the X,Y,Z, cords, and then a "TEXT" entity at the same coordinates with the text height value and the point number string. Both entities need to be on the layer ending in "-PN". The layer name will change depending on the date. I have a third party program that creates the DXF file.
The point of the lisp file is to insert the point numbers and points into my drawing at their correct locations. For the life of me I can not make this work. I have attached the little bit of lisp I have, which unfortunately does not work properly because of it searching for the "TEXT" entry in the DXF file of which there are three per point number. I only need one. I have also attached the DXF file I have. maybe just an overall procedure that I can then code myself? I'm just not good at getting lisp to read a file and extract what I want from it.
View 4 Replies
View Related
Sep 18, 2000
I would like a lisp routine that can extract and export the x, y, z coordinates of all the points in a drawing into a text file so I can use the same in excel.
View 9 Replies
View Related
May 28, 2013
A quick lisp routine to extract the elevations of a selection set of 2d polylines? I have a massive "contour" file composed of 2d polylines with elevations. I need to find the min and max polyline elevation in selected areas. I can't figure out how to extract just the elevations of my selected polylines so I can quickly see the elevation values?
View 9 Replies
View Related
Sep 12, 2013
I've got a linetype that's part of our autocad template file and has been for so long that nobody around here even knows where the original line file is.
I need to extract the linetype out so that I can make some minor modifications. I did do a search and found a nifty lsp routine from Paul Turvill. (Here's the thread that pointed me there: [URL] ..........
I ran it and it SEEMED to work. All the linetypes in the file it created look good EXCEPT for the one I needed to extract. That one looks like this in the line file:
*TREELINE,Series of arcs used to indicate tree drip lines
A,0.0001,-0.0001,
The linetype DOES display properly in the dwg file (meaning lines drawn using it look good).
View 5 Replies
View Related
Jan 3, 2012
how to extract value X Y Z of point p3 p4
(defun c:test ()
(vl-load-com)
(setq actdoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq objm (vla-get-ModelSpace actdoc))
(setq obju (vla-get-Utility actdoc))
(setq oldhigh (getvar "Highlight") oldsnap (getvar "Osmode") oldblip (getvar "BlipMode") oldecho (getvar "Cmdecho") );setq
(setvar "Highlight" 0) (setvar "Osmode" 517) (setvar "Cmdecho" 0) (setvar "Blipmode" 0)
[code]....
View 4 Replies
View Related
Apr 25, 2012
I have a inserted block with 4 tags for Length, Thickness, Elevation and Width.How can extract attributes tag values and draw a closed polyline + 2 internal lines, parallel to the block?
Block Name: ID_DATA
Tags: LEN, THI, ELE and WID.
Each internal line placed in a third width.
View 9 Replies
View Related
Aug 16, 2012
I'm dimensioning an old drawing with the real (measured) dimensions and with the drawing dimensions in brackets (using ' 1500 (<>)' to give '1500 (1505)' for example.
What I'd like is to also be able to put on the difference between the length I type in and the length in brackets - as this would let me see any really glaring errors that can't be attributed to user-error on the laser measure.So I could type in '1500 (<>) (X)' where X is the formula, and get ' 1500 (1505) (5)' back?
How to be able to run a script that could highlight any dimensions where the number is brackets and the typed number have a a difference of, say, 50.Or failing that, any way to extract all the dimension text at the end into excel so I can see the differences myself?
View 1 Replies
View Related
May 14, 2012
how to sensibly extract angular dimensions as attributes.
I can extract the attributes from a block containing angular dimensions, the attributes list angular dimensions as a field but don't actually list the number of degrees for the angular dimension.
It is the number of degrees that I am actually trying to obtain - but I cannot work out how to obtain the information
View 3 Replies
View Related
Mar 8, 2012
Is that possible to have a lisp to extract the Field Expression of a attribute in a block?Specifically, to extract the property VALUE (TextString) of this attribute.After to extract, I would like to put this text extracted in a different layout tab, in the same drawing. In this way, I will have a text linked to the attribute value between two layout tabs. So, when I have to change the attribute value, the text will be updated automatically.
I know that if I use the FIELD command to manually copy and paste this value it will work, but when I have a lot of attributes it becomes very laborious.
View 9 Replies
View Related
Jul 23, 2013
I design a small plant in Autocad 2012. For the pipes we used cylinders and boxes(for square pipe), now we need to make the bill of materials, but I don't know how to extract the data from each cylinder(radius and height) or box.
It is possible to do this?
I place a small sample from the plant. Totally I am having around 6000 elements.
View 9 Replies
View Related
Mar 5, 2012
How can I extract all layers in an open drawing to a notepad or txt file?
View 7 Replies
View Related
Sep 15, 2011
I was wondering if it was the COND statement that I would need to use to evaluate a block to confirm that two attribute tags existed and if so, if would process the block to perform an attribute extraction of both of those tags. It would ignore blocks that only had one or the other attribute tags - and only extract the attribute values if the block had BOTH of the tags present - It could be blank, but it had to exist.
For example, I want to find blocks that have the attribute tag "PART_A" and "ID" - and then create a CDF that has the value of "PART_A" in the first column and "ID" in the second column. Then it closes my CDF file.
Then, I want it to scan my drawing again for blocks that contain attribute tag "PART_B" and "ID" and then re-open that CDF file and append the values so that the values of teh attribute "PART_B" is in the first column and the values of the tag "ID" are in the second column.
I have been playing with the following code --- is there anyway to modify the code to get it to do what I need? I have already removed the part that writes the header-row....
View 1 Replies
View Related
Sep 14, 2012
I am currently using this code to get the folder name containing the current drawing.
FolderName = Dir(ThisDrawing.path, vbDirectory)
What would I use if I wanted to get the foldername one level up (third)?
ex. C:FIRSTSECONDTHIRDFOURTH
View 3 Replies
View Related
Aug 10, 2012
I'm working on a lisp that goes through a whole list of files and does different things to those files. I've been racking my brain for a way to select just a folder via a dialogue box, but haven't found a way. I'm sure it can be done with dcl, but I don't know where to start.
This would not be the standard "file" selection box, but would only list the folders and let me select one even if there are others "under" them. This is what I'd like it to look like.
I'm not sure if there is a standard AutoCAD box that I could call for this or not
View 5 Replies
View Related
Feb 12, 2013
I'm try to write a list to produce a script file!I just want to insert a dwg file in current drawing.back to MS Windows, in case of having [space] in a folder's name, we should use "" marks:
CD "Program Files"; DEL "file 10.txt"; ....
I tried both with and without "" marks but I failed!I pasted part of my code below with result of each case:
(setq TBFile "H:z.autocadA1 A2 A3.dwg")
(write-line "-INSERT" des)
(write-line (strcat "*" TBFile) des); ; *H:z.autocadA1 A2 A3.dwg <<=should be this
(write-line "0,0" des);;insert point
(write-line "1" des);;xyz scale
(write-line "0" des);;rotation
[code]....
View 4 Replies
View Related
Jun 5, 2013
How to create lisp which i can simply type in to the command bar so that the current drawing's filepath-folder will be automatically opened by windows explorer?
running AutoCAD 2012 / Windows 7...
View 9 Replies
View Related
May 10, 2012
I would like to put our company programming on a Dropbox folder. I have not fully tested everything out yet, like locations of lisp files and image name...
One thing I am struggling with is an absolute path in my lisp file:
(setq FL:FLAYTAB "C:\Users\dvanerem\Dropbox\Canova and Stone\Customizations\Autodesk AutoCAD 2010\Programming\OENV-RCP.TAB")(FL:LoadTable)
I am confused how this would work with other users? Or does AutoCAD automatically correct for this?
View 2 Replies
View Related
Feb 7, 2013
I was wanting to create a script to go through and clean up a bunch of drawings in a given folder. I've written a lisp routine (cleanx) that works fine when you run it on a single drawing, but I'm having some trouble integrating it into a script. As it is currently, I'm experiencing several issues -
1) It prompts the user for an 'object' after finding 0 objects. It seems to be caused by the line,
(command "-layer" "u" "*" "t" "*" "on" "*" "" "")
in 'cleanx' based on the text window, but I'm not sure why it does that given that if I run cleanx directly it doesn't prompt me.
2) It ends with saying 'Really want to discard all changes to drawing?' which confused me as I use Qsave before I close, and then confused me further when I realized that the text window suggests that this prompt comes up after the 'open' command, and that if I type <Y> (exit without saving) then it asks me to select a file. Why doesn't it save, close and then open the next file automatically?
;;; Main program, command: batchjob;;; By Abdul Huck(defun c:cleanb (/ dwgs file dwgName scrFile folderName) (setq folderName (browsefolder "Select folder to perform batch job: ") ) (setq dwgs (vl-directory-files folderName "*.dwg")) (setq scrFile (open (strcat folderName "\batchJob.scr") "w")) (write-line "SDI 1" scrFile) (foreach file dwgs(setq [code].......
View 5 Replies
View Related
Jan 2, 2014
We used a block which contains deisel expressions for our plot stamp. When we publish through the sheet set manager it shows a temp folder where the drawings are spooled to instead of the actual drawing saved path. We can fix this buy turning off background plotting when we publish, but I was wondering if there is a way to show the saved path instead of the spoolled path when publishing in the background.
Below is the expression found in our plot stamp block.
$(GETVAR, "dwgprefix")$(getvar, "dwgname")$(edtime, 0, M/DD/YYYY H:MM:SS AM/PM), $(getvar, loginname)
Civil 3D 2013
Windows 7 64-bit
Xeon W3550 3.07 GHz
Nvidia Quadro 4000
12.0 GB RAM
View 4 Replies
View Related
Feb 11, 2013
Is there a way to identify non-standard layers and the files in which they're located?
The folder I'm working with contains thousands of DWGs and I've discovered some layer names which differ from our standard naming conventions.
I need to clean up these anomalies so am seeking a way of identifying/locating them.
View 2 Replies
View Related
Sep 20, 2012
We have user folders on severall servers, now I want the user menu's to be stored on the network so their home folder depends on what server it's located on. I tried using the vl-file-directory-p command but it doesn't seem to work.
Even worse, as soon as the userfolder is found I want to let the script check for a file called user.cuix in the Acad folder and if it doesn't excists copy it from another location to that folder (if possible).
This is what I got so far:
(setq UserName (getvar "loginname"))
(setq RootZW "\\users\zw\")
(setq RootVL "\\users\vl\")
(setq Company "\\CADConf\ACAD13\")
[Code] ..........
Next to this we have 4 other options as well, but to keep it short I left it at the first 2.
View 2 Replies
View Related
Jul 12, 2012
Is there a lisp that will allow me to do a continuous dimension, but will alternate the dimension position from low, high, low and high? If there is no lisp already created, how to create one?
See Continuous dimension attachment for example.
I work at a glass and glazing company and this is how we dimension mullion width and DLO. See typical window dimensioning attachment for window elevation with dimensions.
View 6 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
Oct 7, 2013
Is there a way to programatically set a visual style before a drawing actually opens?
We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings. Some models will crash on some workstations when trying to open in a rendered mode.
I found a lisp with a function that looked to set viewport visual styles. But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)
View 9 Replies
View Related
Oct 11, 2012
I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.
attached is what I have written so far:-
View 4 Replies
View Related
Jun 20, 2013
Lisp that switches back on Selection Preview i.e. thickens and highlights lines when you hover over them?I don't know why, but they are always unticking the boxes.
View 4 Replies
View Related
Sep 7, 2012
Is it possible to execute a certain command based on multiple selections withinin a dcl? for example: two radio colums, one with selections A and B, and a second with selections 1 and 2. is it possible to program commands based on user selections from each column? ex: if A and 1- do a command. A 2- do a different command, etc...
I tried :
(action_tile "key1" "(setq A t")
(action_tile "key2" "(setq B t")
(action_tile "key3" "(setq 1 t)(done_dialog)")
(action_tile "key4" "(setq 2 t)(done_dialog)")
(if
(and (a) (1)
)
(command ...
but was unsuccessful. no matter which combination was selected, the command under all combinations would run.
View 2 Replies
View Related
Jun 3, 2013
I am trying to find a lisp that would get an attribute value (tag name = NBR_5) . I'm trying to run a simple routine that would let the user place the value from the titleblock attribute as text on a drawing. I see a ton of articles regarding getting attributes but I am not well versed in programming.
View 9 Replies
View Related