AutoCAD Visual LISP / AutoLISP :: Copy Text Or Line Then Change Its Color To Green
Mar 29, 2013I'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 RepliesI'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 RepliesI was trying to do one that can change color and line weight using a number provided by user. What i want to do is to ask a number to the user, 5 for example, and then change the color to 5, and the lw to .5. I was starting with this:
(defun c:ccv (/ eco lun ob cc clw)
(setq eco (getvar "cmdecho"))
(setq lun (getvar "lunits"))
(setvar "lunits" 2)
[code]......
but is not working, it has a bug with the clw variable.
I'm trying to write a lisp routine to create a two line MLEADER but i can only get one line of text. Creating the MLEADER manually from the command line i just have to hit enter after the first line of text to add a second line. How would i do this in a lisp routine?
View 2 Replies View RelatedI have spent the last three days writing a lisp program that will copy a text string from one text file and paste it into another. I have tried using the write-string, getstring, prin1, princ and print functions with no success.
View 6 Replies View Relatedi am looking for a lisp routine which can change all lines in color yellow ( in different layers) to color 8.
View 9 Replies View RelatedI have a custom command that I can initiate (c:TxtE). The function starts running but I need to begin adding several inputs at the command line following this. (ex: "4" "all" "" "oldtext" "newtext"). How do i do that within lisp once the custom command has already begun? If I need to modify the function how would i pass all these as optional type variables?
View 7 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.)
I need a Reactor to Modify Xdata - Length - contained in Line Object if this Line is modified (stretched, breaked, trimmed, etc).The routine need to verify if Line contain Xdata and modify it (and works with multiple selection).
I tried for long hours, but without success. I tried to create a list of entities while the reactor is applied, but doing so need another reactor to change these entities after the first Reactor works.The codes I used are below:
{code}
;If it just 1 string only you want to add
(defun add_xdata_str (e a v);;;EName APPID String_value
(and (not (tblsearch "APPID" a))
(regapp a))
(and (= (type e) 'ENAME)
[code]....
I am writing a program that allows the user to select hatched areas in a drawing and return the quantity, area, and the weight for the equivalent areas covered by tread plate.
My goal is to insert the data with text at a point of the user's choosing, so the end result is a text object in model space that looks like this:
Total Objects: 2
Total Tread Plate Area: 20.83 sq ft
.125 AL Tread Plate Weight: 40 lbs
.125 Steel Tread Plate Weight: 128.33 lbs
How to do is to have the text appear on multiple lines, instead of all across one line. Is there a way to mimic the enter key to enter the next line of text, just like when you use the text function in AutoCAD, instead of using multiple text commands and having to position each one using code.
(defun c:tread (/ cnt tot ss p sqft alwt stwt)
(vl-load-com)
(setq cnt 0
tot 0
[Code] .....
I have some general knowledge in lisp coding. But I can't seem to figure this one out (even to get started). What I want to do is make a lisp that:
- selects a line
then
- select any amount of text (any type)
then
- moves all the text to that selected line without rotating the text
if a line is perfectly horizontal then move the text of the y axis.
if the line is vertical then move the text of the x axis.
or there can be a prompt asking the user to chose the angle or axis in which the text will move (say if they want to move the text to a slanted line, you can choose to move the text on an angle, while keeping the same format and not rotating the text, or you can ask the user if they want to move it only vertically or horizontally)
I would really like the code to integrate into my autocad.
See pictures
I have the following code which isnt quite working, it reads a text file which has a list of Names of images and their bottom left coordinates i.e. name x y etc. I want it to check for a name equal to that input then in this case alert the user it is found, eventually I want it to load the tile but for the moment where am I going wrong, also the lisp wont close the file and I dont know why.
(defun c:imi ()
(setq IM (getstring "
Input name of 2010 tile"))
(while (not (= "" IM))
(setq TILE (strcat "BM" IM))
[Code] ......
I am a beginner at LISP and this is a bit out of my league... and I'm trying to create a lisp where I can draw a polyline between 2 points that also places text with the actual distance offset above the line.
I did find this post and I'm not quite catching on.. [URL] ......
I use the following lisp to control my window background colour,
;Setting window colour to crimson (uses OLE colour code system)...(vla-put-TextWinBackgrndColor(vla-get-display(vla-get-preferences(vlax-get-acad-object)))3937500)
However I would like to change the drafting tool tip background also using lisp, but I don’t know which vla-put-….. I need?
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]....
I am looking for a lisp routine to search the layer table to find a particular layer color and change color.
View 9 Replies View RelatedI want to change all pline in drawing to a specific object color (color 253). My code is not working & my brain is not functionning properly today...
(DEFUN C:TR() (SETQ ALL_PLINE_IN_DRAWING (ssget "_X" '((0 . "LWPOLYLINE")))number_of_pline_in_dwg (sslength ALL_PLINE_IN_DRAWING)entity (ssname ALL_PLINE_IN_DRAWING 1)data (entget entity)new_LAYER (list(cons 62 253))data (append new_LAYER data))(entmod data));END OF DEFUN
I have a keyboard shortcut for Copy (see directly below). This command doesn't copy multiple. But if I type "Copy" at the comment prompt (AutoCAD 2013) the copy multiple is the default. Copymode is already set to "0".
(DEFUN C:C()
(setvar "SNAPMODE" 1)(COMMAND "_COPY")
(PRIN1)
)
I 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]....
Would like to be able to select mtext explode it get x y coords of last line of text then turn it back to mtext and then launch mtext at a @0,-0.5 justification TL width 5 and display the ribbon.
All seems to work except the (command ...)
Below is my attempt.
(prompt "Select Note")
(setq ss (ssget))
(command "explode" ss)
(setq ss (ssget "l")) ;get last line of text
(setq ent (entget (ssname ss 0))
ent1 (cdr (assoc 10 ent))) ;get x y coords
(command "undo" "1") ;set exploded mtext back to mtext
(setvar "lastpoint" ent1)
(command "mtext" "@0,-0.4" "j" "TL" "w" "5")
I am trying to get a default value (from global variable) put as the default for getstring command. Problem is I want it as if I had typed it into the getstring command so I can modify it if required. It is for entering filenames which only change slightly ie 1129E09LS1 ...LS2 ...XS1 etc.
Current
(setq BlkName (getstring "
Enter Civil Cad File to Import: "))
For defaults that I don't want to change I usually use this format:
(or BlkName (setq BlkName (getstring "
Enter Civil Cad File to Import: ")))
I don't give the right keywords with Google !?So from a classic selection (or ALL for ALL Blocks of the DWG) of entities,
we will keep ONLY blocks (Static or Dynamic)I am looking for a Lisp/VLisp routine to update all Color of Hatches inside Blocks when the Hatch Color is xxx If the color hatch is NOT XXX we don't update !
The problem : update all hatch from blocks where Color = 255 (or any other value)
---> other classic Color (1-256)
--> RGB Color 255,255,255 or any other
I don't know at all how to switch hatch entities from classic color to RGB color inside a Block..And dynamic block in Lisp/VLisp are far from my level 0.2 in Lisp ...
I want a lisp to change all object colours from bylayer to its color Example (if layer doors its color is blue the color of objects drawn in this layer will by blue not bylayer)
View 9 Replies View RelatedI have a library that has a primary folder with 11 subfolders. If the LISP can go through all the subfolders, that would be great. But, if it cannot, I can work with going into each subfolder and running the routine. There are over 12,000 files and I don't have the time to open each one and change the color.
Here's what I need the LISP to do:
open the drawing
select everything
change the color to "bylayer"
save
close
open next drawing in folder and repeat
Once it gets to the end of the folder it can stop.
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.
There are a ton of lisp to match text rotation to a selected line, but not vice versa.
View 9 Replies View RelatedI required a lisp for sorting Multiline text in alphabetic order. (Ascending and Descending)
For example in my drawing it contains lot of Mtexts having multi rows. I need to sort texts inside Mtext. Like PDC-012, DAG-012, AAG-096. I need that Mtext should be AAG-096,DAG-012,PDC-012.
I'm attempting to create an easier way to change layer colors of nested linework by selecting the linework and having the ACAD index color dialog box appear to select the replacement color.
defining the "ic" variable;
(defun c:clc (/ ent ent_data ic ent_lay) ;change layer color(setq ent(nentsel)) (setq ent_data(entget(car ent)))(setq ic ;index color(cdr(assoc 62(ACAD_COLORDLG))))(setq ent_lay(cdr(assoc 8 ent_data)))(command "-layer" "c" ic ent_lay ""))
I have a Lisp that I have been working on with some folks in the office, and i feel like i am close, but i am not getting the cigar. The idea would be to have the lisp allow the user to select a nested x-ref entity, and change the color and linetype of the selected layer, similar to the old "LAP" command (I know it is a dinosaur, but I still miss it). I seem to be doing swimmingly, code I have quasi-plagiarized. It seems to crap out where i try to pass the selected linetype back to the layer. I get the nastygram "Command: ; error: no function definition: GETLINETYPE" right after selecting the linetype from the dialog.
Code below...
x(defun c:CX (/ Sel EntList DataList cnt Num ClrNum EntData)
(if (setq Sel (nentsel "
Select object to change layers color and linetype: "))
(progn
[Code]...
HP Elitebook Workstation
Windows 7
I'd like to change a layer's color from command line because of a user icon. I figured out from previous topics that I should use macro similar to this: ^C^C_filedia;0;-la;s;Verdeckt (ISO);c;1;l;dashed;;_filedia;1;re;
(I want to use this macro to change layer's linetype, too, but that's not the point)
The only problem with this macro: layer's name contains a space therefore Autocad tries to recognize Verdeckt as a command (and macro interrupts there) instead of setting Verdeckt (ISO) as the current layer. I've tried using different quote marks, none of them worked (' and " and <>). I hope there's a method for entering a parameter that contains space.
Software: Inventor Series 2011 SP1 x64
OS: Vista Business x64
CPU: E6400
RAM: 2*2Gb GeIL
VGA: Quadro FX 550