AutoCAD Visual LISP / AutoLISP :: Code To Link To SCR File
Feb 19, 2012
LISP code to link to a scr.file.I would like to run ACADDOC.lsp with abobe code everytime I open a drawing.But I want to link the KISP file to script file of mine like C:
View 3 Replies
ADVERTISEMENT
Apr 3, 2013
I know to get the spacial filter on an xref to get the clip verticies, but not how to tell if its an invert xclip.
Even the arx guys seem to have difficulty with this. How to do it with lisp, com, or arx code?
[URL] ......
View 1 Replies
View Related
Sep 18, 2013
I need a lisp code to convert all Lines, Polylines, Arcs and Splines to Polylines with 0.4 width.
I prepare this:
(defun c:CH2pl ( / SS);changes all lines, plines, arcs and splines to POLYLINE with 0.4 width(if (setq SS (ssget "_X" '((0 . "LINE"))))(command "_.pedit" "m" SS "" "Y" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "*POLYLINE"))))(command "_.pedit" "m" SS "" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "ARC"))))(command "_.pedit" "m" SS "" "Y" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "SPLINE"))))(command "_.pedit" "m" SS "" "Y" 10 "w" 0.4 "")))
But I want pure lisp code in a professional way!
View 9 Replies
View Related
Aug 20, 2013
Modify the attached lisp I found in this forum to work using a different hatch pattern, scale and angle. The new hatch should be in default Autocad "LINE" pattern and angle set to 90 degrees (vertical). If possible, I would like the angle and scale to be editable. Find attached Multi_Hatch-45 code posted by CADaStroumph in 2008.
View 9 Replies
View Related
Jun 18, 2013
This lsp was passed on to me from a colleague but he doesn't know where he got it. It does a useful procedure of placing each xref, residing in the drawing, to a unique layer. The layer name is derived from the xref name. I would like to edit this to take only part of the xref name. This system I work with requires all files to have the job number as a prefix eg LE1399901_Contours.dwg, so the xref name would be LE1299901_Contours by default. I want to remove the first 10 characters to be left with "X_Xref-Contours" layer name using this code.
(defun dxf (i a) (cdr (assoc i a)))
(defun c:lxr ( / ss cnt xrs en ed bn xp xbn )
(setq ss (ssget "x" '((0 . "INSERT"))))
(setq cnt 0)
[code]........
View 5 Replies
View Related
May 27, 2012
The problem I'm having is that even if I try using the most basic code, taken from this tutorial:
[URL].........
I still get an error as if the dcl file didn't exist. Both the lisp and the DCL files are both set in the same folder, together, no sub-folders or anything like that.
Here's my
- DCL:
samp1 : dialog {
label = "Structural Holes";
ok_cancel;
}
- LISP
(defun C:samp1()
(setq dcl_id (load_dialog "C:UsersEugen IancuDesktoplearnLispsamp1.DCL"))
(if (not (new_dialog "C:UsersEugen IancuDesktoplearnLispsamp1.DCL" dcl_id))
(COMMAND "ZOOM") ;;THIS IS WERE MY FUNCTION GETS STUCK. I ADDED THIS SO I COULD [code]......
View 5 Replies
View Related
Sep 22, 2011
Where I can find the DXFIN command code? I want to examine it to see how it does what it does.
View 2 Replies
View Related
Jan 1, 2014
I have this code to draw grid lines within a rectangle:
;Variable settings(defun var_set () (setq *var_lst* '("cmdecho" "osmode" "expert" "plinewid" "dynmode") *var_usr* (mapcar 'getvar *var_lst*)) (mapcar 'setvar *var_lst* '(0 0 2 0 0)) (vl-load-com))(defun var_reset ()(mapcar 'setvar *var_lst* *var_usr*)) (defun *error* (msg) (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" "" nil)) ) (princ (strcat "
Error: " msg)) ) (and ;(vl-bt) (var_reset) ) (princ) ) (defun string-list (data) ;by lee-mac @theswamp (if (vl-string-search "@" [code].........
The above gets me the grid lines; but I have a block inserted at both ends of the grid line; how do I get the selection of those entities (selection set "frame") after each array?
or I would need to map a point list and draw each grid individually how do I go about that?
Attached is the sample of the output I'd like to achieve using LISP.
View 3 Replies
View Related
Dec 4, 2012
The code removes prefixes bind ($ 0 $), renaming layers, blocks, dimension styles, but some objects do not change the name as linetypes, text styles and duplicate names.If I have an existing name, I want to change the name with a (2) at the end.Example.
Layer: FloorLevel$0$Door90
If the layer "Door90" is existing, is renamed to "Door90 (2)"
(defun c:delprefixe(/ ActDoc Name NewName)(vl-load-com)(defun RemoveBindPrefix (String / Pos LastPos)(if (setq Pos (vl-string-search "$" String))(progn(setq LastPos Pos)(while (setq Pos (vl-string-search "$" String (1+ Pos)))(setq LastPos Pos))(substr String (+ 2 LastPos)))String));
[code]....
View 3 Replies
View Related
Dec 5, 2007
Is there any way to grab the Object ID or name from a layout tab to use in a field? I wish to link the layout name to a callout block so that if the layout tab changes position and name (inserting a new tab), the call out block will update no matter what page it is on. Without using the Sheet Set manager.
View 9 Replies
View Related
Aug 6, 2013
I have lisp code, which count total length, but I need that it count and multiply by constant which I choose manual (such as in example, total lines yellow length * y + total blue lines * x = ... , example 50*2 + 60 * 3=280),
remember the another code, such as I have d200 with total l=1000 and d250 with total l=1500, i need to count total cost such as 1000*y+1500*x
one think, diameters numbers is not only 1 or 2, it can be many different diameters.
dwg file here:
[URL]..........
lisp file here:
[URL]........
View 9 Replies
View Related
May 20, 2013
hiding the modellayout from code.My code is updating the registery properly.but it is not reflecting/hiding the model/layout tabs in application. hide/trunoff from code.Model/layout is not required for my application.Is there any command to hide model/layout tab.
void CMyApp::TurnoffModelViewLayoutTAB()
{
//TurnOff Model View Tab
[Code]....
View 2 Replies
View Related
May 16, 2012
I have the following code in a toolbar button that when I click on a setup within this tool it imports that setup into my current dwg. How to edit this code so that it will continue to import the setup of choice into the new drawing..but in addition....set the new one current & delete all previous setups that were in the drawing?
^C^Cfiledia;0;^Rpsetupin;"K:/_BARONE TEMPLATE FILE-2012/BARONE_PAGE_SETUPS.dwt";filedia;1
View 9 Replies
View Related
May 2, 2013
I'm trying to check for the existence of a drive using lisp, then if not found perform a task (represented in my below example by the alert)
(if (vl-file-directory-p "C: en") T)(alert "exists"))
I know it doesn't work because if I change the T to nil as demonstrated bellow I should invoke the opposite reaction from autocad but instead I get the exact same outcome which is an alert telling me the file exists?
(if (vl-file-directory-p "C: en") nil)(alert "exists"))
View 7 Replies
View Related
Jul 23, 2013
My code returns the error, but it still works.
(vl-load-com)
(setvar "cmdecho" 0)
(vlax-for ucs (vla-get-UserCoordinateSystems (vla-get-Activedocument (vlax-get-acad-object)))
(setq UCSList (cons (vla-get-Name ucs) UCSList)))
(setq FileName (vl-Filename-Base (getvar "Dwgname")))
(setq NewUCSList (vl-remove-if '(lambda (x) (vl-string-search FileName x)) UCSList))
(setq Listlength (length NewUCSList))
[code]....
View 4 Replies
View Related
Feb 10, 2013
i have in Drive C a file "Steel.lsp" have function called IPE
in this function have this line
(setq n (getstring "
Enter IPE Height :"))
i loaded it
i created a menu and command in it called "Amr"
no i need when i click Amr Run IPE with string 270 then click enter
i need all this happen automaticlly when i click on "Amr" on menu
how???
View 2 Replies
View Related
Dec 23, 2011
So I can run the following code from the command line with no problem:
(WRK-Insert_Standards_Block '("S:\AUTOCAD\_Common\Linetypes\CSW_Civil-Linetype"))
(WRK-Insert_Standards_Block '("S:\AUTOCAD\_Common\Linetypes\CSW_Survey-Linetype"))
(WRK-Layer_Insert_all "CSW-X-FM_Layers_List")
However when I put it into a macro (custom command to be used from the ribbon) it spits out the following in my command line:
(WRK-Insert_Standards_Block '("S:
View 2 Replies
View Related
Sep 13, 2013
I'd like to set up a blockwith different attributes like Roomname, Floor, Area,...
Therefore I'd like to link a polyline of the drawing with the block and it shows me its area. I know how it works with fields, but not how to connect it when the field is within a block.
Is there a LISP for that?
View 4 Replies
View Related
Jan 24, 2013
Is there a way by which I can link a paper space block attribute to model space block attribute
In other words
Paper space as a block Title and attribute "QTY"
Model space has a block X and attribute "QTY_MODEL"
Is it possible to edit "QTY" and as a result get automatic update on "QTY_MODEL"
I am not familiar with diesel/macros yet in Acad.
Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013
View 4 Replies
View Related
Feb 21, 2013
Possible to link an xref layer and local layer so they display the same (eg. sync viewport colour, linewieght, line type)?
I insert xref's for my base drawing but legend is on local layers and I would like to be able to ensure that the line colour and linetype always match...
View 4 Replies
View Related
Dec 4, 2012
I am trying to export each sheet in an Excel file to an separateTXT files.
I currently have code to read each cell in a sheet, but unfortunately some of the Excel sheets have in excess of 5000 cells and it is taking too long to read. So I am switching to another method.
The program will check dates of TXT files and XLS file to make sure TXT files are current (if not, open and recreate TXT files).Then read the TXT files (much faster).
Where I am getting stuck is 2 places -
Get the names of each sheet in the excel file (not always a known name)
Save each sheet as separate TXT file.
Here is condensed code so far without error checking, etc -
(defun E2TXT (FileName /)
(if (and (setq XLfile (findfile FileName)) (vl-file-systime XLfile) (setq XLapp (vlax-get-or-create-object "Excel.Application")))
(progn
[Code]....
View 4 Replies
View Related
Aug 20, 2013
(if (findfile MyFile)
(setq fl (open MyFile "a"))
)
the file exists however the open function still returns nil... the file is not read only, and permission on the file appear to be just fine.What other reasons would there be that cause open function to return nil?This is happening only on one machine. All the others are writing to the file just fine.
View 5 Replies
View Related
Dec 20, 2012
I have a file path im trying to capture in a text file however its not working and autocad is prompting back,
; error bad argument type: streamp nil
Im assuming its because of the slashbacks but Im not sure..
Hence the code so far...
(defun C:GO ()(SETQ ACADLSP (findfile "acad.lsp"))(setq f (open "C: est.txt" "w"))(write-line ACADLSP f)(close f))
View 4 Replies
View Related
Dec 22, 2011
I am trying to make a script file to open a drawing and run a lisp routine. They both work independently just fine, the script file will open the all of the files fine... and the lisp is in the startup suite and works in all the files. But when I tell the script file to open the first drawing then run the lisp it hangs trying to open the next file after running the lisp. I have Filedia set to 0, but the message I get when it goes to open the next is "No canvas exists. click New Canvas." (And on top of that... Filedia even set back to 1 still does not display the Dialog box anymore, I have to shut down AutoCAD 2012 and start again then it works.) I Have tried several ways, Opening one at a time then run lisp, and open all files first and then try to run lisp (that closes the file after running) and try and run it again in the next... It will only run the lisp one time and then locks up from there.
View 7 Replies
View Related
Sep 3, 2012
I have more DWG files, all dwg file convert same size (A3 SIZE) PDF file and combine one PDF file. Find script program or lisp program.
I have script program for convert dwg file to pdf file but i don't know all pdf compile one pdf file.
View 1 Replies
View Related
Sep 21, 2012
Autocad 2008. Certain command and mouse control unable function.. which the error dialog box shown when start up launch the autocad...
" Customization file load failed. File not found: COMMANDLINE.cui
View 1 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
Dec 31, 2011
my LSP file. My computer is stolen and i have a backup in flash memory. I just wanna run it but i think it is corrupted. When i open it, it has codes like.
View 2 Replies
View Related
Sep 24, 2012
Now i attached more logos in the drawing file. The logos all in JPG files.This all jpg files in different locations. Every time i sent file to email attach with all jpg files. Some time i forget the attach files. So i need 'how bind all jpg files in the drawing file'. Now i am working with AutoCAD 2013.
View 3 Replies
View Related
Aug 27, 2013
I used to have a short, one-line macro in my MNL file that would read the location of the currently active drawing, find the parent directory of that drawing (truncated to 3 levels) and open a Word document in that directory that is named after the project.
For example, if the active drawing path is
"Q:/Projects/12345 Cold Storage/Elevations/Phase 1/North Storage.dwg"
this macro would open the Word document named
"12345 Cold Storage.doc"
that was in the directory
"Q:/Projects/12345 Cold Storage"
If the file did not exist, it would be created named the same as the 3rd level directory.
After i wrote this, it sure sounds like a lot, but as i remember, it was a short, one-liner. Of course if a lisp routine would be better, that's okay too. I understand beggars can't be choosy.
View 9 Replies
View Related
Apr 3, 2012
Looking for example of a lisp file that take the value of a variable and create a txt file on a specific place defining by the user, with 10 lines in each one of them begins with what is in the variable, followed by a text already done.
View 3 Replies
View Related