AutoCAD Visual LISP / AutoLISP :: How To Edit Code To Import Setup Of Choice
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
ADVERTISEMENT
Oct 7, 2013
For example :
command is beginning with choices
1- choose number ... ( 10 / 20 / 30 ) :
2- choose color ... ( red / blue / cyan ) :
after choices if 1.st choice is 10 and 2.nd one is red , then run to AAA command
after choices if 1.st choice is 20 and 2.nd one is blue , then run to BBB command
after choices if 1.st choice is 30 and 2.nd one is cyan , then run to CCC command
simply like that..
View 3 Replies
View Related
Jan 9, 2013
I found a lisp routine on the internet to change page setups on multiple layouts. The lisp worked but on some of the layouts it moved the viewport off the paper background (see attached). The layouts print fine but the only way to get the viewport back on to the background is to open the page setup and click modify, then ok and close. I tested this on a .dwg that I had saved to my computer rather than on one in the main folder but I would like to do this to to all are maps since our IT decided to rename our printer and now all pages setups are no good.All I know about lisp is how to run one.
;; Copy current layout page setup to all layout tabs
(vl-load-com)
(defun c:CPS (/ Adoc Layts clyt)
(setq aDoc (vla-get-activedocument (vlax-get-acad-object))
Layts (vla-get-layouts aDoc)
clyt (vla-get-activelayout aDoc)
)
(foreach
itm
(vl-remove (vla-get-name clyt) (layoutlist))
(vla-copyfrom (vla-item Layts itm) clyt)
)
(princ)
)
View 1 Replies
View Related
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
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
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
Sep 9, 2011
We are using this code for Page setup. But We don,t know how to make this page setup current and active.
(defun c:pgs ()(acet-error-init(list(list"cmdecho"0"osmode" 0)T))(vl-load-com)(setvar "Tilemode" 0)(vla-Add (vla-get-PlotConfigurations (vla-get-ActiveDocument (vlax-get-acad-object))) "A1" :vlax-false)(vla-put-PageSetupOverridesTemplateFile (vla-get-files (vla-get-preferences (vlax-get-acad-object))) "A1")(setq item (vla-Item (vla-get-PlotConfigurations (vla-get-ActiveDocument
[code]........
View 3 Replies
View Related
Sep 16, 2013
I'm trying to set up a height label for sections and elevations. I then want to update it with a shortcut.
I already tried it with a field that shows me the y coordinates, but it won't show me the "+-"0.00 sign,when I put it to zero level. It only writes "0.00".
View 9 Replies
View Related
Jun 13, 2013
I would like a routine that will determine if 'Page Setup A' is in the drawing and if so, apply 'Page Setup B' to all all layouts within the drawing. I would like to have it run upon drawing open in the ACAD.lsp
Basically we've changed our master page setup names, and now when a user switches to modelspace then back to paperspace the layout loses its configuration.
View 3 Replies
View Related
Nov 25, 2013
Is there any way of applying a new page setup to all the layouts at once?
View 5 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 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
Dec 27, 2013
How to add the sheet description field into the rename & renumber window? I ask this because during the sheet set-up process we use the sheet description often, and I would like to go from sheet to sheet without having to right click and edit every sheet.
Civil 3D x64 2012
Win 7 x64 Ultimate
I7 3820 (3.6ghz quad core with HT)
32gig RAM (Corsair XMS3 4x8g)
Intel x z79 mobo (BOXDX79TO 2011 socket)
Radeon HD 7850 2gb GDDR5
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
Aug 6, 2013
I have a block named "WD_MLRH". There are 3 specific attributes which I want to change in it. The attribute names are.
RUNGCNT, RUNGDIST and RUNGFIRST.
RUNGCNT will = 20
RUNGDIST will = 1.0 (or 1 will suffice)
RUNGFIRST will be decided by a user input.
Something along the lines of...
(setq RUNGFIRST (getint "Enter first rung number: "))
I'm sure this is completely wrong, but i hope that portray what I'm trying to accomplish.
View 9 Replies
View Related
Oct 30, 2012
I want to edit 1 attribute value in a block to number all my blocks (eg A001, A002, A003...) (example picture attached)
I know about the at tout and at tin but I need a lsp routine that only changes one attribute value without having to double click and go through that.
i attached a lsp routine, how to edit and remove everything except the value part.
View 9 Replies
View Related
Mar 26, 2012
I need to edit a text in my dwg using a script.
How I do it?
View 8 Replies
View Related
Jun 4, 2013
I've started a new job and inherited a lot of custom files and menu's without documentation.
The company CUI is setup as the enterprise menu and displays READ ONLY on my system. And the company palettes all have a padlock displayed. All relevant files are on the server.
WHat rights do I need to edit and update these files?
View 7 Replies
View Related
Dec 13, 2013
I'm having issues with updating an MTEXT attributes value using lisp.
If I insert my block (this is a titleblock) and run my lisp routine the MTEXT attribute updates fine. Once I edit the MTEXT attribute with the MTEXT editor, and then run my lisp routine again, the MTEXT attribute will not update anymore. All the single line (DTEXT) attributes update fine. The lisp routine I created has worked for years...this is the first time I've tried it with an MTEXT attribute.
View 5 Replies
View Related
Sep 13, 2011
We have had custom toolbars for many years that included custom pop menus etc. Now that we are running cuix customizations how do I edit these customized pop menus? Do I need to rewrite this stuff in lisp, vba, .net, whatever?
View 1 Replies
View Related
May 11, 2012
whether within AutoCAD or thru Autolisp or VBA, to individually edit text that has been grouped. Ungrouping and regrouping is too cumbersome. Search and replace will work, but will change all instances of text that match the search / replace criteria.
View 3 Replies
View Related
Aug 7, 2013
I have many texts fields in my drawing. I need edit the format of all field. e.g field - 1030.60 convert to - 1.030,60 Is there any lisp doing that? I mean, select multiple field and change it.
View 3 Replies
View Related
Jan 26, 2012
I'm looking for a lisp routine that i can globally change the text height and width factor of a particular block attribute. The name of the attribute tag is "TAG". I would like to be able to select all the blocks that i need to edit and then specify what text height and width factor i want to change to.
View 9 Replies
View Related
Sep 2, 2011
If LISP can be used to edit a diesel expression in a field inserted in dtext? I need to adjust the last number in $(+, $(GETVAR, USERI2),1) .
View 4 Replies
View Related