AutoCAD Visual LISP / AutoLISP :: Renaming Xref Using Code
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
ADVERTISEMENT
Jul 31, 2009
Is it possible to run a lisp which can extract all the xref names, make a layer with that name and then change the xref on the layer? I have got a similar routine from earlier posts but it doesn't work if any xrefs inserted in paper space (works fine on model space). could change this routine allowing to change the layer of xref in paper space too.
(defun dxf (i a) (cdr (assoc i a)))
(defun c:lxr ( )
(setq ss (ssget "x" '((0 . "INSERT"))))
[Code].....
View 8 Replies
View Related
Oct 2, 2012
I am using (trying to anyway) a :VLR-xrefSubcommandReloadItem reactor. My only question is how to get the xref/block name from the 'reactor callback data' Object ID.
I am ultimately trying to pass it to (vla-get-xrefdatabase ....), but I cannot figure out how to turn the second parameter from the reactor callback data into something I can use - for example the second parameter returned may be "65" or some other number.
Civil 3D 2011
Windows 7 x64
View 1 Replies
View Related
Oct 12, 2011
I have set up a master set of dwg. files we use to create our construction documents. The files consist of a master file that xrefs base files. All of our files are named using the project # first. (i.e. 2011001c.dwg). I have set up the master set using x's to replace the numbers.
Here is how it works:
XXXXXXXc.dwg (master file) relative path xref's the following files.
XXXXXXXlw.dwg
XXXXXXXvlw.dwg
XXXXXXXeg
XXXXXXXfg
XXXXXXXtitleblock
note: all of these files are saved in the same folder.
I am trying to find a way to keep the xref paths working when I copy the files to a project folder and rename the files using the actual job # insead of the x's as place holders. As it is now, when I change the drawing name the reference is lost and I have to manually change all of the xref paths in the xref manager. Is there a command, program, or lisp routine than can change the file names and update the paths automatically.
View 1 Replies
View Related
Mar 20, 2013
I have a specific problem with renaming layouts. I found some similar lisps, but I just could not make them work.
In every layout I have following attributes.
PROJECT: 306
PHASE: RD
OBJECT: A0101
PART: EL
DRAWING: 611
ZOOM: X
REVISION: 01
I need to rename every each of layout using those attributes. Layout's name should look like that: "306_rd_A0101_el_611_x_01" . "rd", "el" and "x" must be written using lowercase.
View 9 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
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
Jan 27, 2012
I am looking for some mleader customization.Basically looking for a mleader that will add an objects name(in my case an xref or block) in the text. Attached is a picture of our current process... nothing special. basically instead of typing in text we use the insert field. In the field dialog that opens we select "object" under Field names, then under object the type button is pressed to select object(in my case and xref or block) then under property the "Name" option is chosen. This will insert the xref name in the multileader. This is not terribly hard but am curious if I can automate and save some steps.
View 1 Replies
View Related
May 10, 2012
I can't seem to find the SYSVAR that controls insert to 0,0,0 instead of pick on screen..
Quad Core 2.3GHz Intel, 64-Bit, Win 7
16GB Ram, 2GB Graphics Card
256GB SSD
View 2 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
Oct 1, 2012
How to edit this string so that it would change ONLY XREF layers in a dwg. to color 3 bylayer, and leave all of my additional layers in the current dwg. as is.
^C^Cchprop;(ssget"x");;color;bylayer;;-layer;color;3
View 2 Replies
View Related
Jun 29, 2013
I'm new to the programming thing, and this one has me stumped. We have a problem with people accidently dragging xrefs. The simple solution would be to put all of the xrefs on a locked layer, but I was vetoed on this suggestion. I've been trying to figure out if I can write a lisp that will do one of the following: Give an alert if an xref is moved.Not allow an xref to be moved.Tell the user when they open a drawing that an xref is not at 0,0,0 insertion point.
View 1 Replies
View Related
Nov 25, 2012
what i would like to do is rename (externally) and repath about 4-8 xrefs in a drawing set of about 100 drawings.
you may ask why? it is because we are trying to establish a template set of drawings for a civil design office. and when we start a new project, copy over the drawings to the relevant project folder, change the project number, run the script across the drawings and go from there. I've also tried this using the reference manager, but it doesn't work when you change the name of the xrefs (loses association)
basically i know if i could use a lisp i would run it using autoscript or something equal. All i need is to figure out the code to change the project number in the xref
for example
current - "xxxx-PN009999-aaa-00-survey.dwg"
change to - "xxxx-PN001234-aaa-00-survey.dwg"
from my research so far, the easiest way is to make a lisp with the following
-rename
b
xxxx-PN009999-aaa-00-survey
xxxx-PN001234-aaa-00-survey
-xref
p
xxxx-PN001234-aaa-00-survey
c:acadcivildummyfolderxref
If this is the correct code, do i have to rename the CAD xref files in explorer first?
View 1 Replies
View Related
Apr 24, 2013
I have the following code that works, most of the time. Actually, it works or completes itself all the time, but there is no "all encompassing" measures incorporated.
All of the reference entities, believe it or not, are on layer "0". There are also some consistent layers, that you can see in the code below. However, a user may create or even remove any layer in the reference drawing. Therefore in my current drawing, I may have layers that are not frozen in the xref.
Like i said, the following code works, but not all encompassing.
(setq filename "7102-002-950 UC10-03")
(setq FreezePRD (strcat filename "|_PRD"))
(setq FreezeSLD (strcat filename "|_SLD"))
(setq FreezeBORDER (strcat filename "|0_BORDER"))
[Code] ........
I guess what I'm looking for is to freeze all layers that begin with "7102-002-950 UC10-03|".
View 5 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 14, 2009
I'm looking for a lisp that will change all the layer colors of selected xref by clicking the xref and select color from the color table palette. I have a routine that would change the layer color of a selected entity other than xref.
;;Changes selected object layer to a true color
;;of chose from a dialog
box
(defun c:cvc (/ ent ent_data rgb str objlay)
(setq ent
(entsel)
)
[code]....
View 5 Replies
View Related
Oct 19, 2011
Is there way get field object att in xref ?
View 3 Replies
View Related
Feb 11, 2013
is it possible to bind an an xref via ObjectDBX without opening the drawing?
View 1 Replies
View Related
Nov 7, 2013
Any routine or way to convert a nested xref to a regular xref?
View 4 Replies
View Related
Aug 15, 2013
I think there is a function that will cause the selected object that is in the XRef to highlight.
View 1 Replies
View Related
Oct 5, 2012
How to edit the string below so that it will ignore all layer names starting with "E-". I want to change all XREF layers in the current dwg. to 161 but ignore all XREFED layer names that start with E- such as E-lighting, E-power etc.
View 4 Replies
View Related
Apr 30, 2013
I need a routine that will duplicate the current sheet's Layout tab and content to the next tab, set it current, delete the titleblock (by name) on the new tab and reference in a differently named titleblock, 1:1, 0,0 onto the new Layout tab. I'll be running this in a batch script.
View 9 Replies
View Related