AutoCAD Visual LISP / AutoLISP :: Creating Trigger That Is Stored In DWG File
Aug 21, 2012
What I need is a trigger saved within a drawing dwg file which if found will launch a lisp to run if the trigger is not present in the dwg the lisp will not run.
If memory serves me correctly the trigger was managed by creating a unique table search item saved in the actual dwg file. A start-up lisp would then search for it and if found it would run the lisp if not it would simply continue as if nothing happened.
View 6 Replies
ADVERTISEMENT
Sep 8, 2011
I want to create a custom linetype that uses a solid rectangle 0.5wide and 1.0 long. Basically I want to create a shape file from an existing block I have so that I can insert it into the linetype definition. Is there an easy way to do this in ACAD 2009?
View 8 Replies
View Related
Dec 16, 2011
This probably isn't the correct discussion group but not sure where else to post this.
My sales department wants to be able to create drawings based on entries in selected in their Excel qouting tool. Basically, they want to configure a product in the field, and be able to show the customer the drawing with TrueView. (They don't have AutoCAD installed).
I would think the best I can do, is manipulate a .dxf file based on their selections but that may get very complicated.
View 2 Replies
View Related
Nov 28, 2008
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.
View 9 Replies
View Related
Feb 11, 2013
I am attempting to create a export command for our surveyors that deletes all there point layers and seal layer, then audits and saves the file before opening the etransmit command.
Below is what I currently have.I know there is a better way to do this, but it is above my programing skill right now.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SURVey export(defun C:SRVY () (command "-laydel" ; Delete Survey data "Name" "F0" "Name" "F1" "Name" "F2" "Name" "F3" "Name" "F4" "Name" "F5" "Name" "F6" "Name" "F7" "Name" "F8" "Name" "F9" "Name" "F10" "Name" "F11" "Name" "F99" "Name" "SHEET-SEAL" ENTER "YES" ) (command ".audit" "y") ; Audits file (command "_qsave") ; Save changes (command "-etransmit" "Choose Setup" "ACAD2010" "Create transmittal package" ) (princ))
AutoCAD Civil 3D 2012 (Primary), 2011 by contract.
Dell Percision T3500: MS Windows 7 64-bit SP1; Intel Xeon CPU W3505 @ 2.53GHz, 12.00 GB RAM, NVIDIA Quadro 600
View 1 Replies
View Related
Nov 4, 2012
i'm newbie in customizing tools in autocad especially in creating hatch pattern. i understand that to create new hatch pattern is by adding a new hatch pattern in acad.pat file with specific angle.
my question is is it posibble to create a hatch pattern that can use specific angle follows the object shape?
This is what autocad can do by default this is what i'm trying to create
View 7 Replies
View Related
Nov 12, 2013
I am creating a line using entmake, but I need the start and end point to be variable that was already defined ex.
(entmake '((0 . "LINE")(8 . "FIELD") (10 . line_insert) (11 line_end)))
Command: !line_insert
(29.2813 20.5 0.0)
Command: !line_end
(29.2813 18.5 0.0)
The error I get is
; error: bad DXF group: (10 LINE_INSERT)
What do I do to make it recognize this variable?
View 1 Replies
View Related
Oct 24, 2012
I've been fighting with building a formula in a block utilizing a field from another block. I have a support steel member that once placed, will be lengthened. I need a distance from center of the pipe to the top of concrete. I created a block with a field referencing the insertion point (center of pipe) it works fine giving me this elevation. I also have another block that is the datum node. I have several fields in this block, and it is located at the bottom of the support steel plate. I am trying to create a field that takes the center of pipe elevation and subtracts the datum node elevation to get a distance. I created the formula referencing the COP elevation field and the elevation of the datum node. The information shows properly where I am building the formula, when I click evaluate, the Preview gives me ##### and when I create the datum node block that is also the output I get. I can't figure out why it won't give me the difference between the two elevation fields. I don't know what I can do differently to have that information in the datum node.
View 1 Replies
View Related
Sep 20, 2013
I have some code that starts a new drawing with a specific template from a lisp routine
(defun ghd:load_newdwg (template / ae-acad-object newdwg)
(setq ae-acad-object (vlax-get-acad-object))
(setq newdwg (vla-add (vla-get-documents ae-acad-object) template))
(vla-put-activedocument ae-acad-object newdwg)
)
The template location and file is stored in variable clienttemplate (and is not the standard template path set under options). All works okay except if I close the new drawing, when I return to the previous drawing that was current when the new drawing was created (i.e. the drawing that the routine was run from). I get the following error:
Command: ; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Unknown exception occurred
; warning: unwind skipped on unknown exception
I assume this has something to do with the original routine not closing/finishing before switching to the new drawing. This is the last line of the routine:
(cond ((= startnewdwg 1) (ghd:load_newdwg clienttemplate)))
View 3 Replies
View Related
Nov 22, 2011
I am able in lisp to create a command prompt selection menu, easy (see code below).However what I want is for the lisp to be ready to undertake an action UNLESS I select an option.
An example is the offset command wich has a function ready to roll (namely the specify offset distance) "OR" I can interrupt the "specify offset distance" and enter one of the sub options (in the case of offset Through/ Erase/Layer).
My code attempts to offset also, UNLESS the user wishes to specify a distance.
(DEFUN C:loadoffset ();CREATING MENU FOR SUB COMMANDS [GETIT] [GOTIT]...(setq choose (getstring "
Select an option... [1=GET DIST] [2=GOTDIST]: "))(if (or (equal choose "1"))(GETIT))(if (or (equal choose "2"))(GOTIT));TERMINATING SELECTION MENU...)(defun getit ( gotit )(setq MYDIST (getdist "
SELECT A DISTANCE: "))(gotit))(defun gotit ()(command "_offset" MYDIST pause pause"exit"))
View 9 Replies
View Related
Jan 10, 2013
In asp I'd write:
arrFileName = Split(DrawingName, "_")
JobNumber = arrFileName(0)
DrawingTitle = arrFileName(1)
SheetNumber = arrFileName(2)
I'd like to do the same thing in lsp. I don't want to be limited to three fields so the split function is perfect.Is there an equivalent?
View 3 Replies
View Related
May 6, 2007
I would like to be able to check if an Annotation Scale already exists and if it doesn't I would like to create it using the SCALELISTEDIT command and then set it to be the curent scale. I then plan to invoke the MLEADER command.
I do not want to have to rely on adding every possible scale in the list beforehand as my program would fall appart when a user decides to set an unusual scale I haven't thought of adding to the list.
See my initial start of the program.
(defun C:MLD ()
(command "cannoscale" "1:55") ;STOPS HERE WHEN 1:55 DOES NOT EXIST
(setq IfAnnoScaleExists (getvar "CANNOSCALE"))
(command "-scalelistedit" "add" "1:55" "1:55" "e")
)
View 5 Replies
View Related
Jan 4, 2012
I have a series of boxes or polygones that I would like the program to find the 1/2 distance and create two seperate polylines from the one object.
Example:
I have a square with pt1,pt2, pt3 and pt4 respectively. After I have ran the program it would create a diagonal from pt1 to pt3 and join the rest of the lines now to create the one polyline. Also it would do the same to create another exact polygonal shape for the other half. Thus creating two shapes of equal value from one.
View 9 Replies
View Related
Dec 2, 2011
cannot find a way to create a pdf and saving it into a desktop. Basically, in the -plot command, there should be an option to allow it to save to C:documents and settings"username"desktopfilename.pdf"
See the command line used:
(COMMAND "-PLOT" "Y" "" "DWG to PDF.pc3" "30 x 42" "Inches" "Landscape" "No" "Extents" "1=1" "CENTER" "Yes" "Fullsize.ctb" "yes" "No" "No" "No" "C:\Documents and Settings\Username\Desktop\Filename.pdf" "N" "Y")
The objective is to allow the lisp to plug in whichever username and automatically creating a pdf based on the filename.
View 3 Replies
View Related
Apr 17, 2012
I have hundreds of drawings I want to run through scriptpro with a script calling 3 different lisp routines. I have the 3 lisps working independantly but can't figure out how to get them to all run in one script.
Two of the Lisps are for redefining the title block in 2 different types of drawings that have different title blocks. The last lisp locks all viewports in all windows. I'll attach the 3 lisps I'm trying to merge in the script. I am not very versed in scripts and lisps so I'm guessing at least 2 of these lisps could be merged into a single lisp...
Here is what I have for the script file contents (which doesn't work):
(load "redefine100")
(load "redefine102")
(load "vlocker")
View 1 Replies
View Related
Dec 25, 2012
I have uploaded the handout for my AU2012 class to Google Drive. The link is [URL] It contains the detailed explanation for all the source code used in entmake-ing and entmod-ing the new MESH (aka Subdivision Surfaces) entities. [URL]
View 1 Replies
View Related
Sep 30, 2011
I wrote the code below (allow the user to pick points in different viewports and then override an existing dimension's text with the difference in X values. The (hopefully) last issue is that the fractions should be vertically stacked and at 100% text size.
(defun c2text ()
(command "mspace")
(setq p1 (getpoint "Select left point "))
[Code]....
View 9 Replies
View Related
Apr 26, 2013
Creating either a Lisp or a script to change the pen weights of two layer in autocad 2011?
View 9 Replies
View Related
Jul 13, 2013
I'm trying to create a model of arrow with which I could place in drawing in any length and orientation I want with lisp. I was imaging to place two point on this arrow and by placing the two points on my drawing, the length and orientation of the arrow would be define.
I'm trying for hours to create it and my grip for polar stretching don't stay still on my arrow (suppose to be on the peak but go far if I stretch it).
View 9 Replies
View Related
Apr 25, 2013
I'm looking for an easy way to generate a on-line riser diagram of blocks that have been inserted on a floor plan.Here's what I was thinking.
For every instance where the block SLC_DEVICE IS insert on the drawing, the routine would insert the block listed in the "TYPE" and place text equal to what is listed in the "ADDRESS". The TYPE is the actual block name.
Each one of these blocks have a tag of TYPE and ADDRESS. What is in the TYPE tag is the block name of what should be inserted and what is in the ADDRESS tag is the text that should be inserted under the block.
So for example; the routine would find the first instance and the tag TYPE which is "Smoke_Detector" and the tag ADDRESS which is 01:03:001. The routine would insert the block "Smoke_Detector" with the text "01:03:001" directly under it. It would insert the next instance the same way a specified distance from the last; so on so on so on until all instances of the BLOCK (SLC_DEVICE ) have been inserted.
The other part of this would be the Block "NAC&SPK_Circuit" but you would use the Tags "Type", "Candela" AND "NacCkt" to generate the one liner.
View 9 Replies
View Related
Oct 22, 2013
I really need a auto lisp that do lines/polyline on line edges creating a polygon like the example.
View 8 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