AutoCAD Visual LISP / AutoLISP :: Sorting A List Of Selected Block

Jun 12, 2013

I found a lisp for counting of selected block in a table drawing, but I can not remove the bottom line of this lisp that displays "total" blocks. How to remove this line from "total" that is created in the last row of the table that lisp.

lisp : ========================================

(defun c:TABL (/ blk_id blk_len blk_name blks ent h header_lsp height i j TOTAL
len0 lst_blk msp pt row ss str tblobj width width1 width2 x y
)

[Code]....

View 4 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Sorting A List

Aug 17, 2012

I have a list that contains data like this,

"Tree-01-08-AA5"
"Tree-04-12-QV"
"Tree-10-30-QS"

How would I go about sorting this list by AA5, QV, QS? I know how to use vl-sort and reverse, but I do not understand how I would go about this. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Point At List Block And Dynamic Block

Apr 18, 2013

I am learning autolips and i found  a problem that i can´t solved.
 
(vl-load-com)(defun c:pmb ( / ss ent pt )(prompt "
selec block : ")(setq ss (ssget '((0 . "INSERT")))) (setq ent (ssname ss 0)), (setq pt (cdr (assoc 10 (entget ent)))) (command "point" pt))
 wich this code you select one block and insert one point at insert point´s block.

which this other code yo select all block and insert all  point.... but in one block
 
(vl-load-com) (defun c:pmb11 ( / sele cod bloque nbloque lista pt ) (prompt "
block: ") (setq sele (ssget ( List'(0 . "INSERT"))) Cod 0 )cod (1+ cod) (repeat (sslength sele) (setq bloque (ssname sele cod)) (setq pt (cdr (assoc 10 ( entget bloque)))) (command "punto" pt) );repeat ) 

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Function To Print Out Entire List Of Selected Entity?

Oct 28, 2011

I am looking for a function to print out the entire entity list of the selected entity...

so... walking down through the entity data... print out what it finds... any time it encounters an entity name... then do an entget and print that out too.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: List Block Attribute Value

Feb 3, 2012

I'm looking for a lisp routine that will globally list all the values from a specific attribute tag within a specific block. The attribute tag is "COMMENT" and the block name is "FSD".

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Last Characters Of Block Name In Selected Object?

Jul 29, 2013

When i export revit drawing with revit family 

the revit family become block in autocad like this

M_Single-Flush - 700 x 2200mm-278353-Ground Level _0_45

usually i want to remove the ID and view name to become like this without have to re type because it is tedious

M_Single-Flush - 700 x 2200mm

something like how many letters you want to remove from last to first ?

or something better like remove this last two dash and the letters embedded inside ( that separate name-ID-View name)  -278353-Ground Level _0_45?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete All The Dimensions Inside Selected Block?

Dec 2, 2010

I need a lisp routine which will delete all the dimensions inside selected block or blocks, including nested blocks inside.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Align Block With Two Selected Destination Points

May 13, 2013

I am trying to write a program to align a block with two selected destination points. 
- first the user is prompted to select a lwpolyline of a block entity
- then he is prompted to pick two destination points

I face problem with the sub-routine SegmentPts. It is supposed to return the coordinates of two vertexes on both sides of the picked point on a lwpolyline using entsel. But here in my program, when i am picking a point using entsel on a lwpolyline inside a block entity, it is not returning the two vertexes on both sides of the picked point. In stead, it returns some other points of the selected LWPOLYLINE. Why it is doing so? Where is the problem in my program?

It works fine with my other programs where i pick on a LWPOLYLINE entity. In this particular case, the LWPOLYLINE is inside a Block entity and the program is not returning correct points.

Please check Lisp Program below:

(defun C:alb()
(setq ent1 (entsel "
Pick on one side of LWLINE ofa Block:" ))
(setq ent (nentselp (cadr ent1)))
[code]........

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert North Block Oriented On Two Selected Points

Sep 19, 2012

I am trying to insert a norht block oriented on two selected points with the following

(defun c:North ( / ss )
 ;Orientate North Symbol
 (setq oldos (getvar "osmode"))
 (setq blk (vlax-ename->vla-object (car (entsel "

[Code] .......

I am not sure how to (a) erase the selected north block, then (b) make the  insert north block in its place bit work.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Dynamic Block With Visibility State Pre-selected?

Dec 24, 2013

I currently insert certain dynamic block into drawings with a short function that first inserts the specified dynamic block and then immediately changes the visibility state to one specified as an argument to the function.

I'm wondering if it is possible / better / faster to somehow insert the dynamic block with the decided visibility state simultaneously. I've been amazed by many capabilities of VL so I wouldn't at be surprised if this can be done. (the dynamic blocks I'm inserting could have many multiples in the drawing but I need this method to only affect the one being inserted at the time the function is called. I currently use entlast to decide which one is being inserted.)

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Possible To Create List Box For Dynamic Block Previews

Sep 23, 2013

I've spent the last week and a half creating blocks that have between 2 and 10 visibility states in order to represent the separate iterations of common valves.

I would like to construct a lsp and dcl (we work off of a network drive that would enable a stable location for an accompanying dcl file along with the base lsp, though I believe that in order to do what I'm wanting done some on-the-fly dcl manipulation may be necessary) that would display the current drawings in our dynamic block folder and upon selection within the first List_box, would display the different options for visibility states for the block in the 2nd list_box. After a user selects one of the visibility iterations that are now displayed in the 2nd list, an image preview (or slide, I can handle creating the different slides for each block once if required) of how the block will be displayed in the selected visibility state would be shown in what would be the 3rd space, this time an image preview and not a list_box, though I would like proportionality between the list_boxs and the image preview. Some white space is allowable in the list_boxes.

I'm not even sure if this would be possible, but I'm assuming you can access the different visibility states in the same manner that you could access polyline verticies or block definition attributes.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: List Cmd Block Reference Shows Only First Line Or Two?

Mar 1, 2012

BLOCK REFERENCE  Layer: "TWC Dim"
Space: Model space
Handle = 27879

The above result from LIST > 'Last' ... gave only the above result.

We have a project... granted, the requirement is to model 1.6 million feet from world origin... I know that AutocAD can have issues with this... and we have certainly had issues on this job that can be attributed to this... BUT WHAT ABOUT THIS ISSUE?

When anything is INSERTed into this drawing file, or from this dwg file... it doesn't seem to show up... no command line errors, no OFF or Frozen layers, no objects Isolated, no indication at all that there was a problem... except that nothing showed up.

This was used to find the issue. List the last object added to the database. Then paste to original coordinates (NOT PASTE AS BLOCK)

Command: list
Select objects: l
1 found
Select objects:

[Code] .....

No more info.. no block name, no Handle, no Insertion point x,y,z... no scale factors, none of the normal info that should accompany the BLOCK REFERENCE LIST output.

Several Audits were done, and Recover... this reported fixing Invalid Block Refs... we even rebuilt the dwg in a blank dwg file... but still object INSERTed with this same behaviour.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Dynamic Block Based On Previous Selected Point

Apr 9, 2012

For a program i am working for i have to extract the base point of a dynamic block.

This can be done perfectly by this function:

(cdr (assoc 10 (entget (car (entsel)))))

But i want the entity selected based on a previous slected point. So for example when i selected pt1 (which is a point at the border of the dynamic block) i want to be able to extract the base point on the block whit this point.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Sorting A String Of Numbers

Aug 31, 2012

acad_strlsort will sorts strings, but what if my list looks like

("1" "2" "3" "10" "11" "12" "20")

i am sure i have seen it done ina simple way using vl-sort or vl-sort-i

but am not able to find...

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Sorting Multi Line Text In Alphabetic Order

Apr 23, 2013

I 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.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add List To A List

Jul 15, 2013

I have a list -

(setq List1 (list "Line A" "Line B" "Line C"))

I would like to add each item in an existing list to a new list -

(setq ListNew (list "This is some text" "This is more text"

the following is the part I can't figure out - it just adds the list to the list, not the individual items

(mapcar '(lambda (x) x) List1)))

I am looking for ListNew to be - (a list with 5 strings)

"This is some text"

"This is more text"

"Line A"

"Line B"

"Line C"

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add String To Each Item In List Using Lisp

Nov 14, 2013

I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg").  how would i go about doing that using LISP?

View 2 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 :: Removing Nested Block From Main Block?

Oct 3, 2013

I get an AutoCAD drawing from my conveyor manufacturer who have buried a block (tagname) in all of their conveyor blocks.

The only way to remove them is to manually use BEDIT and erase the tagname block.

Is there a way through Autolisp to search all blocks in a drawings and if the tagname block is part of the definition of the conveyor block, erase the tagname block or redefine the conveyor block without the tagname block.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Block Name Of Anonymous Block

Mar 8, 2013

When dynamic blocks are inserted they're assigned an anonymous block name.  I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.

Need a bit of code that handles this?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block Insertion Routine Based On Block File Name

Apr 5, 2013

Create a routine that looks for a block based on a portion of that block name, using a specified path or search path. 

For example, block to search for is BLOCKABC123, so if someone inputs ABC or 123 as a block name, it will locate that block within that folder and inserts it into the drawing at a user specified location.

Ideally, if there is a check in that if it finds more than one match, then perhaps it flags or prompts you to choose 1, 2, or 3 option which block to use.  But I can live without this special function if it requires too much time to code.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Match Multiple Attribute Values From One Block To Another Block

Feb 12, 2012

I need to match few attribute values from one block to different block. I download a lisp file called; ca.lsp which can match the single attribute value. I modified it for more than one attribute value matching. It is ok but still wish to overcome two issues for batch prcess

1. picking up the blocks by selection

2. click the alternative block numbers of times to match the numbers of attribute values I needed.

How to modify this lisp I can run it by block name selections instead of picking selection which enable me to run batch process for numbers of drawing? That will be good...

Lisp & Demo file attached (Match attribute value, A, B & C to Attribute 1, 2 & 3).

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: File Name In A List

Aug 26, 2012

I have a list like ("a.dwg" "b.dwg" "c.dwg") and an filename "b.dwg"

I want to know if the file name is a part of the list. which function must be used for this?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Scales To List

Oct 13, 2013

I need to modify the code below.

When I run the command and write the scale, I need to change the name of the scale and the ratio automatically. The ratio should always be in the format "1: #", also the name of the scale. Maybe assigning more variables with "setq", I do not know.
 
(defun c:test ()(setvar "cmdecho" 0)(setq name (getint "
Type the scale you need:"))(setq ratio (strcat "1:" "0.1"))(command "-SCALELISTEDIT" "Add" name ratio "Exit")(setvar "cmdecho" 1)(princ))

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: List To String

Jul 11, 2013

Here's one that I could use on that i can't figure out:

I have a list of a bunch of descriptions that looks like this:

("00.02.00" "CTD01 Mainframe PT1 (top)" "GD01")

What I am doing is grabbing the middle item and i need to break this up into 2 lines.  So, my code below grabs the first 3 "words" in the second item in the list and puts them in a list, but I need to convert this back to a string.

(setq desc6a (list (car (read (strcat "(" (cadr input6) ")" )))(cadr (read (strcat "(" (cadr input6) ")" ))) (caddr (read (strcat "(" (cadr input6) ")" )))))

I tried a bunch of ways but can't get it

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get The NEXT Element Of A List?

Apr 25, 2013

I've been experimenting with lists and I'm curious about the fastest / easiest way to get the next element from a list:

Currently my best shot is to wrap (member 2 '(1 2 3)) with: (car(cdr (member 2 '(1 2 3))))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert A Block / Explode And Rename Nested Block With Suffix

Nov 30, 2012

I have a block that i want to insert several times and revised each one to be different to do this i would have to insert it and rename the blocks that come in and then reinsert i would like to insert and have a lisp explode the main block and rename the other 2 blocks with a suffix at the end depending on how many times its in the drawing... can this even be done? My original block name that will be first inserted is "BENT PULLEY NOTES" it needs to explode after i drop it in and then there are 2 blocks within that called "Bent Pulley" and "Bent Pulley DYN" that i was hoping to keep the names but add a number at the end depending on how many are in the drawing already...

here is a lisp that i have found... it would work if i didn't have nested blocks and only wanted the one block to be insert and not explode...

(defun c:Test (/ e i name Bname )
(setq e nil)
(command "_.-insert" "Drawing1.dwg" pause "" "" "")
(if (setq e (entlast))

[Code] .......

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block To Annotative Block?

Dec 23, 2013

I have a dwg with 40 blocks that have a non-annotative property. I can go through 1 by 1 and change the property to annotative and redefine the block. Is it possible to automate this? I have done some google searches but have not found anything I am able to cut and paste or put together to get it to work.

Civil 3D 2012 SP4.0 Windows 7 Enterprise 64-bit
C3D 2014 SP1
Dell M6600, Core i7 @ 2.3GHz, 16 GB ram
Dell T3500 workstation, too much ram to post

View 3 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







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