AutoCAD Visual LISP / AutoLISP :: Find And Replace Group Of Blocks That Are SELECTED

Jul 17, 2013

I having real difficulty finding a lisp that will find and replace blocks.  There are plenty out there and AutoCAD 2013 and lower has a Find and Replace Blocks.  However, the frustrating catch is I can seem to find a routine that will allow me to replace only those blocks that I select with a selection set of my choosing.  The built in function replaces all of them and will not let you exclude some.  We have PID drawings that we want to replace valves on, but not all valves.  We don't want to rename.  We don't need to BEDIT the existing block. 

1) Pick group of blocks

2) specify a new block that will replace all instances of old block

3) replace inserted block with different block.  Leaving others alone.

I'm thinking this should be easy, but my search has failed.  The blocks in question are not dynamic or attributed either.

View 3 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Select All Blocks Like Selected Blocks With Window?

Feb 28, 2011

(defun CELBLKS ( / e blk ss blkl)
 (setq blkl ""  ss (ssadd))
 (while (setq e (entsel "

[Code]....

i have this lsp, it works great but how can modify it if i want select with a window.? exemple: if i have 3 differentes blocks, i want to select them with windows and the lisp select all blocks that are identical of those 3.?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Batch Replace Blocks

Feb 22, 2012

We've recently converted all our microstation drawings to autocad now that the company has decided to go with one cad program company wide.

One of the issues we are having after getting the drawings back from the this co. converting them is the cells to blocks convertion inside the drawing. when we open a drawing and see a "Fuse" block for instance and if it a has multiple inserts, it named them:

Fuse
Fuse_1
Fuse_2 etc....

is there a lisp routine or some command that would replace the "Fuse_*" blocks with "Fuse"..I've been searching the forums and know about the express tool Replace Block but need to be able to automate somehow.

I thought about trying to rename each of the "Fuse_*" but of course it won't let you rename to a block name that already exists..

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Replace All Blocks

Oct 5, 2011

I am looking for a routine that will replace all blocks named "DgnMisc_nodepoleind" with a block named "DgnMisc_nodepoleind2" keeping the insertion point. I could use (command "-insert" "DgnMisc_nodepoleind=Y:/ACAD2007/DA settings/Library_new_scale1/DgnMisc_nodepoleind2.dwg" NIL ) but my problem is that the block I want to replace is used on two different layers and I only want to replace the ones on layer "TPSYM01".

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find And Replace Multileader Text

Jan 25, 2012

I'm looking for a lisp routine that can find and replace multileader text.

I want to replace "T." with "T+" and "B." with "B+".

All the multileaders are on layers with a suffix of "-elev".

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Search And Replace Predefined Blocks

Jul 11, 2013

1) I want to search the drawing for the pre-define block names given in the program.
2) If the are there, I want to replace them with the new version.
3) Program replaces the first block it finds, then tries to insert that block.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Replace Block On Different Layers With Different Blocks

Jun 20, 2012

I was able to write a LISP that replaced each node with a block of my choice.However, now I need to find a way now to replace the blocks with different blocks.Each point shares the exact same block called "PILE". Different blocks are on different layers and have 11 different colors. I'd like to replace blocks on layer 1 with a block called "1" and blocks on layer 2 with a block called "2" and so on.I was hoping there would be an easy way to do this in LISP, but I've been unable to get any of my scripts to work.

I've attached a link that visualize what my drawing is currently looking like: [URL] ......

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find And Replace Unique Attributes Using Script?

Jun 7, 2010

I have a “PART” block with attributes tags “PARTMARK” and “SHEAREDFROM” inserted 5 to 10 times in 10 to 50 drawings.

The “PARTMARK” value is always a unique number entered in autocad.The “SHEAREDFROM” value is calculated in Excel and exported to a “SHEARED.txt” file.

In each “PART” block I need to replace the “SHEAREDFROM” value based on the unique “PARTMARK” value, using a script that uses (or incorporates) the values from the “SHEARED.txt” file.

So far the only solution I’ve come up with is having a unique value for the “SHEAREDFROM” and –attedit to change the values in a script. However if the script doesn’t encounter a "K20-1S" in the first drawing it errors out and doesn’t proceed to the next. Below is an example of my rudimentary script.

(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-1S" "K20-1S" "8-60x192")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-2S" "K20-2S" "2-60x144")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-3S" "K20-3S" "2-60x132")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-4S" "K20-4S" "4-60x120")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-5S" "K20-5S" "0.7-60x120")

I’m assuming I need LISP to do this, but my LISP skills are limited. I think I would need a setq for each unique shearedfrom value (setq K20-1S (“8-60x192”))? Then somehow search each drawing for the unique shearedfrom value to replace.?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find And Replace Pre-defined Text / MText Value

Feb 10, 2011

Is there a lisp or script program that will find and replace pre-defined text/mtext value of eg " issued for tender " for "issued for construction" without having to select anything.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Using Vl-string-subst To Do A Find And Replace In External File

Dec 11, 2012

how I could open an external .CSV file which is assigned to a variable called INFOFILE and scan line by line and replace each instance of the string "WIDGETTE" with the string "WIDGET"? I assume the function vl-string-subst woud be involved.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Globally Find / Replace Text Across Multiple Drawings

Sep 16, 2002

I am trying to globally find and replace text in Autocad 2000 drawings. If I have a folder containing 10 Autocad files, I want to open every file in that folder, while in each file, search for a certain line of text and replace that text, then close that file, open the next and find/replace text in that file.

I've created an autolisp file that allows me to open all the files in a certain folder, but I can't find any way, either thru autolisp or scripts, to allow me to find and replace text in each autocad drawing without using Autocad's "find" command to manually enter the text when each drawing is open.

I want to setup the autolisp file to accept input up front, save the "old text" and "new text" to variables, then use those variables as the lisp routine is running.

This version was used to automate creating PDF files. The command 'PDF' is a command from another Lisp file.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Find The Fore-most Point Of A Group Of Entities

Feb 15, 2012

I have a lisp routing that the user has to use, to create a ucs, that is exactly on the front of the entity the user selects, so that whne they are drafting, labeling, dimensioningn the 3D entity, none of the drating lines are hidden when plotted.

The code is as follows:

(setq obj (vlax-ename->vla-object ent))

(vla-getboundingbox obj 'LowerCorner 'UpperCorner)

(setq LowerC (vlax-safearray->list LowerCorner))

(setq UpperC (vlax-safearray->list UpperCorner))

[code]...

Then I do a condition to see which points are greater than others, and move the ucs depending on the view to the foremost point.  The program works perfectly.... however, often, they forget to use it.

I was wondering if I could incorporate it in another lisp that everyone uses, but not having the user pick the entity they want to be in front of (sometimes they pick the wrong entity).  Instead, take the group of entities (anywhere between 1 to 30 per drawing (these are piping spools, so the entity count is not that great in model space)) and set a front working plane in model space.  Working in paperspace is not an option, we're just too deep into our templates and processes.

I know there is a vmin and vmax, but they are for the X and Y axis, a VMax along the Z-axis would be great.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Attribute To Selected Blocks (XY Coordinates)

Nov 30, 2012

i have found the following lisp in a previous thread: (shows XY coordinates of the selected blocks)

(defun C:MyFunc (/ ss Index Ename Lst)
(while (or (not ss) (= 0 (sslength ss))) (setq ss (ssget '((0 .
"INSERT")))))
(if ss

[Code]....

I want this information to be added to the blocks as hidden attributes so that i can extract them by attout. The work to be done is : attout to excel, autofill an attribute (numbering) then attin.

but my problem is that i cant think of a way to number those blocks IN ORDER (ie top to bottom or left to right) unless by sorting them in excel first by their x or y coordinates

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Find And Mark Blocks

Dec 24, 2013

My drawing constitutes of many blocks and other objects , and i need to find specific blocks (with same block name) in my drawing which i cannot find them one by one and i though that i can find them all with lisp routine ..

so , i wanna specify point out of my drawing area and lisp routine will draw to line from basepoint of those blocks to specify point when i select one reference block.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Copy Block Attribute Data To A Selection / Group Of Blocks

Apr 15, 2011

I found a lisp to get block attribute data to a other block. See attachment. I can only apply it to one block. I like to apply it to selected blocks or blocks in a group. Is this possible?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Place Circle On Selected Blocks Insert Point?

Mar 11, 2013

You have a dwg with multiple sets of different blocks and a circle you want to place on the insert point of each set blocks. 

You select the circle then select one of the blocks in the set and the circle is placed on the insert point of each of the blocks in that set. It would save time from doing it manually and save on mistakes.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Automatically Export Attributes From Selected Blocks To Defined Txt File

Oct 3, 2012

How to create a lisp to automatically export attributes from selected blocks to defined txt file without having to everytime confirm the file name, location and if the file shall be replaced?

Meaning is that I often export attributes to txt file for further use. It is always the same file (I just overwrite it always).

The way I do it now is selecting blocks, using ATTOUT command, then going to the desktop, selecting ATT.txt file and confirming that it is to be replaced.

Is there a way to make lisp or script that will just do all it in at once?

I found on forum such a lisp as below, but it exports all ablocks on drawing and it exports to txt file which is located in same  place as drawing and with same name as drawing. Tried to modify it but without success:

(defun cut-att ()
(load "attout")
(setq fna (strcat (getvar "dwgprefix")
(acet-filename-path-remove (acet-filename-ext-remove (getvar "dwgname")))
".txt"
))
(setq ss (ssget "X" '((0 . "INSERT") (66 . 1))))
(bns_attout fna ss)
)

Same question for ATTIN - I use attin and always same file name from same location - how to automate it with one command?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find All Text In Selected Items And Swap Text

Oct 25, 2012

A program that prompts:"select objects:" then I can select some objects like as text, line, circle,... after that program find all texts in selected items and swap text

swap means:   xxx/yyy ===> yyy/xxx ;    "/" is a divisor

swap function for one text is here:

(defun c:swap ( / pos ent el txt)
(vl-load-com)
(if(null #div#)(setq #div# "/"))
(setq #div#
(if(=(setq tmp(getstring(strcat "
Divisor character: <"#div#"> ")))"")
#div# tmp
)

[Code]....

but I want a program to prompt me like this:

(prompt "Select objects:")(terpri)
(setq a (ssget '((0 . "TEXT"))))

and gets divisor char </>:

after that:

(setq n (sslength a))
(repeat n

....

)

repeats n times, n=number of texts in my selection

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Replace Nested Block

Aug 7, 2012

I have a dynamic block that has a nested temporary block inside it. What I am wanting to do is replace the temporary block with the permanent block. I have tried several different variation of coding but I cannot seem to get this bad boy to work. have used:

(vla-put-name (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) "tempBlockName") "newBlockName")

this gives me a duplicate names error. 

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert The Blocks In Dwg File To Lines That Are Centered On Those Blocks?

Jan 24, 2012

I have a project in 3D that I would like to export to Stadd.  This requires lines rather than blocks.  Is is possible to convert the blocks in the attached dwg file to to lines that are centered on those blocks?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Replace Drive By Environment Variable?

Apr 26, 2012

I want to know if it's possible to replace a drive by an environment variable in a search path in the profile. For example:

to replace C:Program FilesAutodeskAutoCAD Mechanical 2012Acadm by %LOCAL DRIVE%Program FilesAutodeskAutoCAD Mechanical 2012Acadm. 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modifying A Replace Block Script

Nov 26, 2012

Is there a way to modify this script so you don't have to manually choose the blocks. Instead have it find all block names starting with "Supply Diffuser 24x24" and replace them with a block in the drawing named V01.
 
(defun C:CHANGEBLOCKS(/ printDebug ssAll ssAllTotal ss ssTotal ssCount ssCount2 ssTotal ssMainBlock ssMainBlock entListMainBlock ssBlocks entListBlock entListBlock2 entElementNewBlock entElementOldBlock entElementOldBlock2 oldBlockName) ;PROGRAM CHANGES MULTIPLE BLOCKS ;WRITTEN BY --- RAUL BENITEZ ;Command reference ;subst - returns a list with a new item substituted for every occurrence of an old item ;quote (or ') - easy way to make the string into a list. ;cdr - returns a list containing all but the first element of
[code].......

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Replace All Occurrences Of Character Within A String?

Sep 12, 2011

There is a lisp function to replace all occurrences of a character within a string?

In short, as the Replace command in Visual Basic

For example, to replace all "x" to "*":
"34x59+60x3" -> "34*59+60*3

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Dxf 1 Group In Multiline Attribute?

Jul 23, 2012

significance of extra dxf 1 groups in the entity data of a multiline attribute? I am looking at one for the first time, so I don't know whether or not to expect multiple 1 groups. In the single example I have created there are two and the first one seems to be ignored. Can I count on that being the case all the time? Data for the one I'm looking at follows, and what shows up on the drawing display is only the contents of the second dotted pair with 1 as a key.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
((-1 . <Entity name: 7ec37d18>)
(0 . "ATTRIB")
(330 . <Entity name: 7ec37d10>)
(5 . "323")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")

[code]...

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selected Text(s) To CSV Files

Nov 14, 2012

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.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: New Layer For Selected Objects

Jan 1, 2014

I need a LISP that create a new layer and ask me for the name and the other properties (color,lw,lt..).

ask me if I want move the selected object for the new layer (yes is the default value)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Detect If There Are Objects Selected

Oct 18, 2012

Any way to detect of there are objects currently selected using Autolisp, visual lisp or even VBA. I would like to be able to do something using that as a conditional, so that (assuming the hypothetical variable isSelected is an on/off indicator of whether or not something is selected) I can code something like this:

(if (isSelected) (...))

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine Required To Replace / Place Block On Each Closed Polyline?

Mar 26, 2012

Does any Lisp routine available to batch replace all the closed polylines with an existing block?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Selection Set Of All Entities Inside Unnamed GROUP

Jan 17, 2012

I am trying to create a selection set (or LIST) of all objects inside a unnamed GROUP.

I found a means to access the unnamed group, however I am having trouble creating the list.
 
Command: (entget (cdr (assoc 350 (dictsearch (namedobjdict) "ACAD_GROUP"))))((-1 . <Entity name: 7efe6280>) (0 . "GROUP") (5 . "130") (102 . "{ACAD_REACTORS")(330 . <Entity name: 7efe5c68>) (102 . "}") (330 . <Entity name: 7efe5c68>) (100 . "AcDbGroup") (300 . "") (70 . 1) (71 . 1) (340 . <Entity name: 7efe6268>) (340 . <Entity name: 7efe6260>))

In the example above, there are 2 entities in the group.

What I want to do is to remove a certain entity from the GROUP, then delete the entity.

Repeat until all entities of that type are removed (I can figure this part out...).

How do I create a Selection Set (or LIST) of all entities inside a GROUP?

To access the first GROUP name in the dictionary:

(cdr (assoc 3 (dictsearch (namedobjdict) "ACAD_GROUP")))

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Prompt Text / Mtext Not Selected

Nov 13, 2012

I’m trying to put together a loop for if nil or something other than text or mtext is accidentally selected than prompt text was not selected. This is what I have so far.

text or mtext is not selected than prompt

(defun C:ww ()
(while
(not
(and
(setq esel (entsel "
[Code]......

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Selected Objects By Value Of Their X Or Y Properties

Nov 23, 2012

I need a program to move some selected text to a line something like as extend command but for text objects!

suppose that there is a horizental line (y=constant) or vertical line (x=constant) and some selected text(or other objects), I want a lisp program that move these selected text (or objects) by their "insertion point" to this line.

in other word, if the selected base line is horizental (y=constant) then property of "Y" of all selected text should change to line's "Y"; and if selected base line is vertical (x=constant) then value of "X" of all selected text should match to line's "X" value.

for example, for base vertical line (x=constant) and 3 selected text(or can be any object) result is:

text1.          |                        text1.|

  text2.        |         ===>       text2.|

    text3.      |                        text3.|

|  .text1                                 |.text1

|    .text2                ===>       |.text2

|      .text3                             |.text3

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved