AutoCAD Visual LISP / AutoLISP :: How To Modify Line Inside A Block

May 20, 2013

I have a simple block with 2 attribute and 1 line inside it.

something like this:

Attribute1

──────

Attribute2

I want to modify length of line due to width of thoes attributs. length of line is equal to maximum(width attribute1 and width attribute2).

dxf code for start point of a line is 10 and end point for a line entity is 11.The question is: how can I modify the length of line automatically via maximum width of these attributes?

for getting width of a text:

(defun GetWidth ( en ) ((lambda ( lst ) (- (caadr lst) (caar lst))) (textbox en)))
sample:

A1
──────                    
Attribute2

Attribute1
──────           
A2

View 9 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Modify Property - Insert Polyline As Block

Sep 22, 2011

I am starting with a polyline then i use the pasteblock command to insert that polyline as a block.Now i can pull up the property box and change the xyz scale.

I would like to know how to change these setting in my lisp.The scale will be x=1 y=0.1 z=1

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Dynamic Block And Modify Stretch Points

Nov 30, 2010

I have a dynamic block that I would like to insert via a lisp routine. When the routine is run from my menu I would like to select two points on the drawing area. Then I would like my dynamic block to be inserted at one of the points I selected and then I would like a specific "point" of my block to be stretched to the other point that I selected. I was wondering if this is possible with LISP? I have my old LISP program I wrote that draws a leader and then inserts my block but that was before I started working with dynamic blocks.

Here is my current

(defun c:wldsym()
(setq osnapold (getvar "osmode"))
(setq orthold (getvar "orthomode"))
(setq dimsc (getvar "dimscale"))
[code]...........  
  
wld1r.dwg is my current block. It has some dynamic properties already. But I'm trying to add new properties that can be seen in my working test drawing wld1r-new.dwg

When using my code with "wld1r.dwg" you can see how everything behaves right now. Then open "wld1r-new.dwg" and note that the insertion point and a stretch point my default are in the same spot. Work with the two stretch points and look at how the block reacts.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: One Attribute At Two Different Locations Inside Of One Block

Aug 5, 2011

Is there a way (or a “trick”) to have one attribute at two different locations inside of one block (I want to avoid filling in the same text twice when this block is inserted or edited)?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Redefine Block Inside Reactor

Dec 4, 2012

I have the following code to redefine a block after a command has ended:
 
(vl-load-com);*********************************************************(defun Redefine() (command "_.INSERT" "reactortest=reactortest" nil)(princ "Block redefined."));****************************************(vlr-command-reactor nil '((:vlr-commandEnded . endCommand)));******************************************************(defun endCommand (calling-reactor endcommandInfo / thecommandend) ; Get the name of the command.(setq thecommandend (nth 0 endcommandInfo)); Check name of the command.(cond ((= thecommandend "PLINE") (Redefine)));cond(princ));defun(princ)

It doesn't work because INSERT is an interactive function and can't be called while a reactor is active. Is there another way to redefine a block that can be used in a reactor? The block is in one of the default search path's.

View 2 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 :: Convert Text To Attribute Inside Block

May 3, 2013

Looking for routine for converting text to attributes inside the block?

In my drawing I hv some attribute blocks having some Text in it. I need to change the Texts inside the blocks as Attribute Texts. I am attaching sample Blocks drawing..

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Find If Point Inside Polygon / Block's Area

Sep 20, 2011

How would I go about this.  if a two blocks or polygons are overlapping area? 

A good method or the algebraic formula for a function to tell me if a point is inside a polygon or block's area? 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine For Replacing Line With Block?

May 21, 2012

Lisp Routine that could replace a line at a specified maximum length with a block at the lines midpoint.

I would love to be able to replace all lines I select which are say less than 0.5m in length with a block at the lines.

View 7 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 :: Insert Block With Pick Point On Line Prompt?

May 8, 2013

I have a lisp routine that I would like to add to. Right now when running the macro the user is not prompted to "Pick Point On Line" in this example

(command "insert" blk "s" var1 pause pause))

I have added the line

(setq pt1 (entsel "Pick Point On Line "))
(command "insert" blk pt1 "s" var1 pause pause))

but the command doesn't seem to like my PT1 value

BLK and VAR1 are set in another lisp routine.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add / Modify And Remove Registry Key?

Feb 27, 2012

Some time ago I was able to add modyfy and remove regestry keys ussing AutoLISP Unfortunatly I have lost the information on how to do this.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Hatch Code

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

AutoCAD Visual LISP / AutoLISP :: Modify Existing Selection Set?

Sep 5, 2012

I need the same funcionality as in code below, but without using "command".

The main idea is alowed user to modify Existing Selection Set.

 (defun gt:ss->lst (a:ss / i lst ) ;_ / (setq i 0) (if a:ss (progn (repeat (sslength a:ss) (setq lst (cons (ssname a:ss i) lst) i (1+ i) ) ;_ setq ) ;_ repeat (reverse lst) ) ;_ progn ) ;_ if) ;_ defun gt:ss->lst(defun gt:ss_modify (a:en-lst / ) ;_ / ;;create Selection set (setq ss2 (ssadd)) (foreach f:en a:en-lst (ssadd f:en ss2) ) ;_ foreach ;;Run command and fill with initial content (command "_select" ss2) ;;Alow the user to modify the contents (while (/= (getvar "cmdnames") "") (command pause) ) ;_ while ;;get back the list of enames from modified selection set (setq ss3 (ssget "_P")) (setq ss3-lst (gt:ss->lst ss3))) ;_ defun gt:ss_modify(defun tst:gt:ss_modify ( / ) ;_ / (gt:ss_modify (gt:ss->lst (ssget)))) ;_ defum tst:gt:ss_modify

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Insertion Point Of Text

Jan 10, 2008

How do I change the insertion point of a text using "vla-put" ? I've tried using :

(vla-put-InsertionPoint en a)) with a = (4455.94 428.576 0.0)

and I get the following error:

lisp value has no coercion to VARIANT with this type: (4455.94 428.576 0.0)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Properties On Multiple Drawings

Nov 6, 2012

Any lisp routine on how to change "Drawing Properties" (fields via Mtext) on multiple single drawing files?

There are several instances where we would need to take a project to create another one and simply change the title block description.

As of now, we are opening each drawing (there could be hundreds) and modifiying the drawing properties on each drawing to change the customer name and other project descriptions.

These are not attributes, but fields. I've researched alot on here and couldnt find anything.

The drawing is attached.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Table Column Widths

Apr 26, 2012

How to modify the column widths of an ACAD_TABLE?

I have known co-ordinates that I want each grip for the table to be set at.  I can't just copy and paste the table from drawing to drawing.  Each table of each drawing have different textual values, and the column widths will best be sized for each text value.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify The Existing Parametric Parameters?

May 2, 2013

Is there a way to modify the existing Parametric Parameters that are in the Parameters Manager using LISP?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Objects Copied From A Selection Set?

Nov 17, 2011

I am creating a selection set using ssget...

Then I copy that selection set multiple times in a loop.  What I would like to do is then rotate (or otherwise modify) the last copied group of items.  If I rotate "last" it will only accept the last drawn item, so only one item in the group of copied objects will rotate.

Here is the portion of simple code I am using right now (it's in a loop so all variables with 'Next' are changing each time):

(command "_.copy" SS1 "" SS1Base NextPT)
(command "_.Rotate" "l" "" NextPT NextAng)

This works fine with a single object, but I can't figure out how to call up the entire group of objects.

Civil 3D 2011
Windows 7 x64

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Or Subtract To Modify Value In Text String

Oct 18, 2011

I need a lisp routine that will add or subtract to modify a value in a text string. Its used for drainage fixture units on waste & vent plans. Example: We use basic dtext strings that look like this [color=red]4"(6)[/color]I would like to be able to add or subtract to the number that is [b][size=12pt]ONLY[/size][/b] in parenthesis and would like to be able to pick multiple text strings at one time so it would result in something like this: [color=green]4"(6)[/color] + 9 will become [color=blue]4"(15)[/color].

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Modify Dim Text Color In Current Dimstyle

Jun 27, 2012

How to change the dim text color in current dimstyle with a lisp routine? I want to modify current dimstyle instead of override current dimstyle, so it can change all existing dim text color under the current dimstyle.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Flatten Inside Blocks

Apr 17, 2012

I wanted to flatten arcs, circles and lines inside a block using the following lisp (which I found in this forum). I found that sometimes this lisp is unable to flatten the ARCs inside the blocks. I do not understand why it is not working for all the blocks. I have attached a drawing in which this lisp is not working.

(defun c:FlattenRaj ( / blocks stpt enpt inspt )
(vl-load-com)
(setq blocks
(vla-get-blocks
(vla-get-activedocument
[code].......

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Color Of Hatch Inside Blocks

Oct 2, 2013

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

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Burst All Blocks With Text / Attributes Inside

Apr 4, 2013

I need a lisp code to burst all "blocks with text/attributes inside" in selected area. That means user should select an area (window selection) and lisp program should be find all blocks with TEXT or ATTRIB inside in selected area and then applys "BURST express tools" command to all these blocks in the selected area by user.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Table With All Characters Inside A Font

Jan 4, 2013

I want to create a table with all characters inside a font.I used "%%" to change a number to it's character.but "%%" limited to 999 and for numbers bigger than 999 it doesn't work.

also, CHR command limited to 255 and for numbers bigger than 255 it change to (number-255). so I used "%%" to create this table:[Please change default font in your AutoCAD to ARIAL]

(Defun c:charmap ()
(setvar "cmdecho" 0)
(setq cnt 1.0)
(setq r_cnt 0.0)
(setq ts 32)
(setq x 0.0)
(setq y 0.0)
[code]...

I want to know:

1- what can I do for numbers more than 999?

2- How can I know the number of characters inside a font?

3-how can improve my LISP program to have complete characters inside the fonts?

View 2 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 :: 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 :: 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







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