AutoCAD Visual LISP / AutoLISP :: Change One Text Inside files By Running simple Script
Sep 7, 2012I have approx 20 autocad files and I would like to change one text inside these files by running a simple script or lisp.
View 4 RepliesI have approx 20 autocad files and I would like to change one text inside these files by running a simple script or lisp.
View 4 RepliesI have a block "MANAGER" with Two Attributes "CETOP" and "CEBOT" I would like a lisp to replace what ever is in those attributes with defined text, for my purposes "Text1" and "Text2". I would like a simple routine that even I can understand so I can apply it to a couple of other lisp projects I have.
View 6 Replies View RelatedI am trying to put together a LISP that changes the font of two text styles. One bing named "Standard", and the other "WD".
This is what I have so far...
(defun C:CHANGESTYLE (/ entities len count ent ent_data ent_name new_style_name)
(command "STYLE" "Standard" "Romantic" "" "" "" "" "")
(setq entities (ssget "X" '((0 . "TEXT")))
len(sslength entities) count 0);
[Code]....
I couldn't figure out how to select mtext and text all in one swoop, so i ran it twice
Now, when i run this code, i get the following error "lselsetp nil".
CADMASTER TECHNOLOGIES, LLC
[URL]....
I have an mdb database, with one table called MATRIX. That table has seven relevant fields, see attachment. What I want to have is for every language an txt file.
Like for example:
DUT.txt
2BK1;BATTERIJKAST sBk
2RK1;REMKAST sBk
and so on
ENG.txt
2BK1;BATTERY CUBICLE sBk
2RK1;BRAKE CUBICLE sBk
and so on
ITA.txt, the same
DEU.txt, the same
ESP.txt, the same
FRA.txt, the same
I have this old lisp routine that I have been using for quite a while and it works and loads just fine, however I would like to open it to see/edit the code... when I open in Notepad however it opens with wierd symbols... How to get this back into normal text?
View 9 Replies View RelatedI want to change a lot of table cell text in one time, try to explain something.
In the front of my drawings i have a view tables. in the second column stays a code that represent a location.
e.g. LVC stays for Low voltage cubicle. Now it is my intention to substitute these code to the description of code in one time and only the second column. The several descriptions are written in an .txt file, like LVC;Low voltage cubicle and on the next row LVP;Low voltage panel, and so on.
I think it is only possible with Lisp? or there are other way?
In the past i did it one by one, because mostly there where 2 or 3 tables, now i have a big project with more than 20 tables.
I need a LISP program that prompts: "select text(s)" then I select for example 100 text in open drawing file.
after that this program creat a file (LIST.CSV) and write each selected text in line by line of this file:
result text file (LIST.CSV ) should be:
Text1
Text2
Text3
...
...
Text99
Text100
ofcourse Text1 is the content of a text object.
I have a window schedule lisp routine that places a 6-sided polygon around text that label each window. I want to change the code so that its a circle instead of a polygon. Here is the code line that needs to be modified:
(command "polygon" "6" "fro" (cdr (assoc 10 (entget templine)))(strcat "@38,-" (rtos (+ (* linecount 18) 14) 2 0)) "C" "6")
im my current coding project im attempting to change the font stlye of 1 text item
i tried used the simple method of
[code]
(command "STYLE" "simplex" "ARIAL" "" "" "" "" "")
[/code]
however, using this changes the text's font in the whole drawing
i searched the forums here and everything i found either didnt work or changed all the text.
is there a more elegant way of doing this with just a selected text item and not the text in the whole drawing?
I have an autocad file with a simple rectangle in it.
The goal is to offset this rectangle 1" to the inside of the original rectangle, then delete the original rectange.
How could I go about this in autolisp??
I know I could use basic commands to bring up the offset functions, but i'm not too sure how i could write autolisp to offset in the correct direction, and the correctly delete the larger rectangle without deleting the smaller one as well.
Maybe put them on different layers? How I could achieve this?
I'm looking for a way to copy a text or a simple line, circle... ; after I copied it, the last entity change its color to green.
View 3 Replies View Relatedhave a simple lisp (no v.b.) program that changes the color of m-leader lines in acad 2010?
IV 2010 Suite
Digital Storm PC:
EVGA & Intel components
Win 7 Pro 64 bit
I am using acad 2010. I have a contour generator that uses 3d polylines to make contours. I get depressions or tops where I don't want them. I need a lisp routine that will allow me to adjust the z value only on any 3d polyline. I need to raise or lower the z value at any vertex and repeat if necessary. I don't need to prompt the user- I am the user.
View 2 Replies View RelatedIn our Structural department, we use a layer called S-35-WALL-LB to denote a load-bearing wall, and what the guys typically do when they are on the sheet showing the floor above, is dbl-clk the VP to activate model space, open the Layer Manager and change the VP linetype to HIDDEN to show the afore-mentioned loadbearing walls as walls under.
way to accomplish this through a viewport...but instead of using the Layer Manager, use a lisp routine I can link to a toolbar button where all the user has to do is dbl-clk the VP, press the toolbar button, and either it will convert the default VP linetype (continuous) for S-35-WALL-LB automatically, or get the user to select an object on that layer and it changes the whole lot?
I want to convert my DGN files to DWG files.
So I write this code in LISP:
(defun C:Batch_DGN2DWG (/path dgnfile SDI_Mode) (setq path "C:\DGN\" ;;Default path for DGN files location. DGNIMPORTMODE 0 ;;Imports the DGN file in a new drawing file. SDI_Mode SDI ;;Save Current SDI MODE SDI 1 ;;SET Single Drawing Mode for AutoCAD. );;setq (foreach dgnfile (vl-directory-files path "*.DGN" 1) (progn (command "-dgnimport" (strcat path dgnfile) "" "" "" "y" (strcat path dgnfile ".DWG")) (delay 100) );;progn );;foreach (setq SDI SDI_Mode) ;;restrore SDI Mode to previous value.)
but I can't finish it!
I attached some DGN files for test purpose.
take a look at the test.dwg it contains a block named 'box' (which is a rectangle) and some attributes. the annotation scale is 1:1 and i zoomed in to focus on one attribute.
change the annotation scale to 1:2 and you will see the attribute grows by 2 - that's ok! now load attmod.lsp and run attmod command and you will see the attribute grows again by 2
even the command only (entmod) the attributes without making any change.(to restore it use battman sync)Is there a workaround to this bug?
Looking for starting point to writing a routine that will open blocks in a drawing and change the colour.We receive drawings from clients with their blocks and would like to have them changed to our company colours.
So basically, i am looking for something that would within a drawing, change every block to a specific color without exploding and redefining. The colour changes will be the same throughout new drawings.
Lisp that can select all hatch in a drawing with a layer called AELE, even if it is embedded in a block and change it to layer AHAT with Green colour?
The layer AHAT may or may not already exist in the drawing.
We need to run the lisp on a lot of drawings (exported from Revit) so I need to use the script to run this lisp on multiple drawings.
i've got a lisp-routine that calulates multiple area's and put the sum in text in the drawing on the place i select.
the sum has to be devided with 1000000 so that it is in m2.
the lisp-routie i use is:
(defun c:ca(/ pt ent txthgt)
;;; bepalen van de teksthoogte indien current style height = 0
(setq txthgt (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE")))))
[Code]......
I have been filtering through this descuession group for a whil this morning looking for what I need and have found somethings that are close but haven't managed to change them a little to do what I am wanting..
I have drawings with a block named UG101 and has been inserted on all sort of different layers.
What I would like to do is run a lisp routine that would select all blocks with the name UG101 and put them on the layer CableInfo.
I have many other blocks that i need to do the same to but with different names, so I was hoping, I could change the lisp routine around to do the rest of the blocks in the drawing..
I found this routine [URL]...... that changes the width of an attribute in a block. After use it, I need to use the ATTSYNC to update the other instances of the bloc in my project.
How to modify this lisp that I receive a prompt to choose if the width attribute will be change just in the selected block or in all instances of the block? In that way, I would not have to use the ATTSYNC command each time.
This is a duct lisp which is i found , which code line i have to change and how for radius value ? for example if my .
" Specify first segment width value " is 1500 then i wanna be my inside fillet radius 1500 / 3 ---------------------------------------------------------------------------------------------------------------------------------------- (defun c:duct(/ actDoc Ang1 Ang2 ptLst enDist fPt lEnt lObj lPln oldVars oldWd plEnd plStart1 plStart2 prDir segLst Start stDist stLst tAng vlaPln *error*) (vl-load-com) (defun GetPlineVer(plObj) (mapcar 'cdr (vl-remove-if-not '(lambda(x)(=(car x)10)) (entget plObj))) ); end of GetPLineVer (defun asmi-PlineSegmentDataList(plObj / cLst outLst) (setq cLst (vl-remove-if-not '(lambda(x)(member(car x) '(10 40 41 42))) (entget plObj)) outLst '() ); end setq (while cLst (if(assoc 40 cLst) (progn (setq outLst (append outLst (list (list (cdr(assoc 10 cLst)) (cdr(assoc 40 cLst))
[code]............
I am working with an application (written in Delphi) that interfaces to AutoCAD via AutoLisp and automation. The app is localized using translation strings that are stored in a database. We are working on translating the menus and dialogs on the AutoCAD side. The menus are no problem as it is easy to change the Label property of the menu items in code on the fly. However I haven't been able to find anything similar for the dialogs. Other then rewriting the DCL file on-the-fly is there any way to programmatically change the labels on the dialogs?
View 2 Replies View RelatedIn our 2010 version users used the "OPT Color Control" in a toolbar. When we went to 2012 we switched our users to the Ribbon. I am not able to move this Control to a ribbon panel. I can place in a toolbar and it works okay. Best I could find is "ACObjectColorCombo", Object Color Gallery drop down. Unfortunately I find that this drop down doesn't handle a selection set the way the 2010 toolbar did. I find that one cannot reliably pick a selection and use this to change objects to color bylayer. I can pick the object prior to using the OPT Color Control and they work fine. I pick the same objects and use the Combo box and sometime they are found and change other times I pick one or two and they work.
Is there a way to move this toolbar control to the ribbon, it will not let me drag and drop to a panel in the CUI.
Is there another solution to change object(s) color in a drop down from a ribbon panel? I have tried searching but am not finding other commands or control with selection drop down in the CUI. (Our choice is not to use the Properties dialog. Which, by the way, does work every time on the objects.)
Is there a way for me to change a layers plot style from one to another with LISP?
We use named plot styles, STB's not CTB's.
I want to be able to create an icon that will change all layers with the plotstyle "normal" to "black". Is this possible with lisp?
I have the following Lisp command that changes a selected layer to a different layer. I have tried modifying it change known layer names to different known layer names. i.e run routine and it changes layer "2" to "3" then changes layer "dim" to "dims" ect then stops.
View 5 Replies View RelatedIs it possible to open a dwg, change something and then plot a layout with visual lisp. This is my start. Opening is working, but plotting not. I have to switch between drawings before the function is going on. Sometimes it's plotting an empty sheet and otherwise an error: ERROR: Automation Error. Description was not provided.
(defun plotbatch ()(vl-load-com)(setvar "sdi" 0);; open file(setq acadobject (vlax-get-acad-object))(setq documents (vla-get-documents acadobject))(setq open (vla-open documents "U:\testfile.dwg" :vlax-false));; changing something;; plot layout(setq plot (vla-get-plot open))(vla-put-NumberOfCopies plot 1)(setq layouts (vla-get-layouts open))(vlax-for each layouts (if (= (setq name (vla-get-name each)) "TestLayout") (progn (setq salayout (vlax-make-safearray vlax-vbString (cons 0 0))) (vlax-safearray-put-element salayout 0 name) (vla-setlayoutstoplot plot salayout) (setq errmsg (vl-catch-all-apply 'vla-PlotToDevice (list plot "\\RW-PRN01\RICOH"))) (if (vl-catch-all-error-p errmsg) (prompt (strcat "ERROR: " (vl-catch-all-error-message errmsg))) ) ) ));; close file(vla-close open :vlax-false)(princ))
I prepared a lisp code that needs high precision calculation:
(defun Time2Frac ( h m s hsec)(+ (/ h 24.0) (/ m 1440.0) (/ s 86400.0) (/ hsec 8640000.0)))
test:
(Time2Frac 23 59 59 99)
it returns 1.0 but the real result is 0.9999998842592
so, how can I change the precision of AutoCAD for some calculation?
I have two attributes "REVN" and "REVD" in a block "ATT" that I would like to change (globally preferably) to the following.
(1) Existing text to keyboard entry text.
(2) Colour from existing to 10
I am a bit lost in the (command "-attdef" .......)
(defun c:atc ()
(setq rev (getstring "Please enter review"))
(setq dat (getstring "please enter date"))
(command "-attdef" .."ATT".."REVN"....."c" "10")..)
(command "-attdef" .."ATT".."REVD"....."c" "10")..)
)
When I click on an object to retrieve it's extended data, the data keeps writing to the right, it does not return to the next line, when the text approaches the end of the screen. Very difficult to analyze information.
View 4 Replies View RelatedI want to know is there any formula/calculation for the width of text object before creation/insertion? At now I used approximated width size via a simple .
(Defun GetStrWidth (str H W) (fix (*(* H W) (strlen str))));;usage: (GetStrWidth "This is a Text." 2.5 0.8);;H: TextHeight; W: width factor.
I know that for the existed text in drawing I can use textbox command, but for the texts that has not been created, what can I do? Is there any formula/calculation depends on font name, text height and width factor?