AutoCAD Visual LISP / AutoLISP :: Scale Changes Upon Inserting Block In The Drawing

Jul 17, 2013

I had been trying to insert a title block (block) in to a drawing as part of changing the title block But in some drawings the block gets scaled off. Is there any system variable or any solution to maintain the drawing without getting scaled while inserting block.

I had used -dwg units and this appears to single drawings only. Any other way to do this to all the files in a folder.

View 1 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Inserting Block On A Point Of Arc?

May 19, 2012

know a lisp routine that would insert a block @ a specific point on an arc? For instance if I have an arc that has a radius of 20'-0" & I want to insert a block at a set distance from the end of the arc.i could probably use the divide or measure command but I was hoping I could do it with lisp. I would also like to be able to move the object along the path of the arc at a specific distance.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting A Block From A File?

Dec 31, 2013

I want to insert a stored block into a drawing (model space).  Below is the code I'm using and I get Runtime Error '5': Invalid procedure call or argument.

Sub Dummy()
Dim COESTD_obj As AcadBlockReference, InsPtStd(0 To 2) As Long, COESTD As String
COESTD = "C:JimHYDROCAD_DwgsBlocksZ_COE_STDS.dwg"
InsPtStd(0) = 0#: InsPtStd(1) = 0#: InsPtStd(2) = 0# 'Set insertion point as 0,0,0
Set COESTD_obj = ThisDrawing.ModelSpace.InsertBlock(InsPtStd, COESTD, 1#, 1#, 1#, 0#)
End Sub

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Block With Insert Command?

Mar 27, 2012

I am working on a lisp file that lets you select a block and automaticaly change the layer and color in block editor. Afther this it exits block editor, deletes the original block and places the new one.

It works fine accept for the last part.

When i incert my new name whit the insert command it automaticaly changes the name whit autofil so it wil still pot my originial block (the new block name is only two characters shorter than the old one).

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting An Attributed Block Using Data From An External Source?

Aug 9, 2013

I am reasonably experienced in coding in VBA but cannot find any references as to how to achieve the above within VBA so am now turning to LISP to see if I can achieve it in that language.

Basically I want to be able to create multiple instances of an attributed block using an external source, e.g. a spreadsheet to provide data for the attributes.

I'm not even sure if this is possible.

I can find lots of references for extracting attribute date to a spreadsheet but I want to go the other way!

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Make Block Uniform Scale?

Oct 8, 2009

Is there any way to make a block uniform scale using lisp? and also make a block drawing uniform scale?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Rotate Block Current Annotative Scale ONLY

Dec 6, 2011

I have the below code (from a user here on the forum) which works great for aligning text, mtext and blocks to 2 points.  For annotative entities, it respects the rotation angle for mtext and text. 

ie I have an mtext object at 1"=20' scale and at 1"=40' scale.  I run the command when the current annotative scale is 1"=40'.  The object at 40' scale has changed, but the 20' scale is unchanged.  This is working as I would like it to.

But for annotative blocks, it gets weirded out.  In the above example, the block at 40' will rotate, but so will the attributes at 20' scale.  But linework and hatching at 20' scale will be unchanged.  it looks really weird. how to get it to play nice with blocks.  Ideally, I'd like the block to be at different rotation angles in different annotative scales.

(defun C:R2P (/ ss ang edata); = Rotate objects to align with 2 Points (setq ss (ssget '((0 . "*TEXT,INSERT"))) ang (angle (getpoint "
First alignment point: ") (getpoint "
Second alignment point: ")) ) (repeat (sslength ss) (setq edata (entget (ssname ss 0))) (entmod (subst (cons 50 ang) (assoc 50 edata) edata)) (ssdel (ssname ss 0) ss) ))

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Annotative Drawing Scale

Apr 26, 2012

I am attempting to create an AutoLISP that removes all un-used drawing scales from a file, then adds the standard scales used in civil engineering. This is what I tried using:

;;;Add Engineering Scales
(defun C:AES ()
 (command ".CANNOSCALE"
   "1" = 1'"
 (command "-scalelistedit"
[code]...

Now, I am only a beginner to writing LISP, but I know that my problem is that it is reading the inch marks after the one in the scale name as a enter, but I don't know how to get around this. Also, I don't know how to get it to skip scales that are still in the drawing.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Dynamic Block Property (Scale Uniformly) Automatically

Dec 16, 2010

How to change the Scale Uniformly property in dynamic blocks accross hundreds of drawings using either/or scripts, lisp, vba or anything else that might do the job.

I just need to open the drawing and select the block (one block per drawing) then edit the scale uniformly property within the block, save then close the drawing and move onto the next drawing.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert One Or Another Block Into Drawing

Apr 22, 2013

I am trying to insert one or another block into a drawing, and i need to do this 8 times per drawing. 

(defun C:detector (/ filename gas pressure)
(repeat 8 (initget 1 "Gas Pressure")
(setq filename (getkword "
Enter Detector Type [Gas/Pressure]: "))
(if (= filename "gas") (command "-insert" "*T:\acad\schematic_circuits\suny\sunygasdetectornew.dwg" pause "" "")
(or (if (= filename "pressure")
(command "-insert" "*T:\acad\schematic_circuits\suny\sunypressuretransmitternew.dwg" pause "" ""))
) ;;end or
) ;;end if
) ;;end repeat
)

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Attribute To Current Block In Drawing

Jan 22, 2013

i have a for example a block with one attribute and would like add a new attribute. i´m trying to read the current block and redefine - it comes a new attribute in propertieswindow but not graphical.

 (defun c:ent () (setq bn (getstring "
give a block name ")) (setq bez (getstring "
give a attribut name ")) (entmake (list (cons 0 "BLOCK")(list 10 0 0 0)(cons 2 bn)(cons 70 2))) (setq fe (entmakex (list (cons 0 "CIRCLE") (cons 8 "0") (cons 10 '(0 0 0)) (cons 40 1)))) (entmake (list (cons 0 "ATTDEF") (cons 8 "0") (cons 10 '(0 0 0)) (cons 11 '(0 0 0)) (cons 40 1) (cons 1 bez) (cons 3 "TOP") (cons 2 "NAME") (cons 70 0) (cons 73 0) (cons 50 0) (cons 41 1) (cons 51 0) (cons 7 "STANDARD") (cons 71 0) (cons 72 0) (cons 210 (list 0 0 1)) (cons 74 0) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "ENDBLK")(cons 8 "0"))) (entdel fe) (entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 10 '(0 0 0))(cons 66 1) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0

[code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Using Parametric Drawing Or Dynamic Block?

Dec 19, 2012

We currently have a bunch of Lisp programs to create drawings but I am interested in exploring how I can maybe use Lisp with either dynamic blocks or parametric drawings. I just don't know which would make more sense. Currently we have programs where we enter things like width, height, leg or radius, bars wide and high etc and it creates a drawing like the one I've attached. I know that if I can create this drawing as a dynamic block or a parametric drawing, then when there are revisions, I don't need to create the drawing again. I can just adjust the parameter or the dynamic block. What makes the most sense, a dynamic block or a parametric drawing? I should note that I'd still like to use autolisp to create the initial drawing (or insert the block) since that's what the users are used to.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create / Insert Block In Drawing

Sep 26, 2013

take a look at this piece of my LISP-routine.

(command "_.block" pause pause ss "")

where:

ss  -  is a Selection set of some entities

In the rest of code, I don't change the values of initdia, or cmdecho, or whatever else  

I haven't sill understood them that well.The problem is the following:

When My routine executes this line, I am promted for:

1. block name - that's OK

2. insertion point - that's OK

3. then the block-command receives correctly the entities from ss-selection set - that's OK

4. then all the object dissapear! **Problem here**

The block is created... I can insert it in the drawing from the block-data base...

But is there a way to let this block stay in the drawing ? without disappearing?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Path For Drawing Containing Block In Script File

May 27, 2013

I am trying to make a script for inserting a standard title block  in some drawings. ( which needs to be often done for different projects). The title block is kept in the network path. How can i specify the path in the script file in order to insert the block.

-Insert,> Block name > (I need to specify the drawing in the network to get the block in it) 

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set Plot Scale By Annotation Scale?

Aug 9, 2012

I am working on automating page setups in model space and am looking for a way to set the plot scale equal to the annotation scale for scaled drawings with

(setvar "filedia" 0)

(setq a (getstring (getvar "cannoscale")))

(command "-plot" "YES" "MODEL" "" "" "" "" "" "" !A "" "" "" "" "" "" "_Y" "_N")

Setting the plot scale with !A causes the lisp to fail.  However, when running each prompt through the command line individually, !A works fine.  what is missing?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Quicker Alternative Changing Annotative Scale In Object Scale List

Apr 10, 2013

I would like to find a lisp that changes the scale of something that has an annotative scale and deletes all other scales in the object scale list.  Often i have many different scales of existing dimensions or objects. i waste a lot of time opening the annotation object scale dialogue box, selecting add, finding my scale and deleting the old scale. 

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Blocks With Attributes

Jan 5, 2012

I've been trying tons of different solutions to solve this problem: insert a block that has an attribute which happens  to be the last object id.

This is the best code I tried so far but without any succss.

(defun c:q1()
(command "_.PLINE")
(while (= (getvar "CMDNAMES") "PLINE")
(command pause)
[Code] .....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Routine Into Fields

Sep 4, 2012

I have a lisp routine:

(defun getLayout (pos / result cLayout layouts^ i len)
; pos = -1 return previuous layout name
; pos =  0 return current   layout name
; pos =  1 return next      layout name
 (cond
  ((zerop pos)
   (setq result (getvar "ctab"))
  ); case

[code]...

which basically returns either the current, previous or next tab name depending on what you call up. Any way to link this lisp to a field? I am doing some plan and profile drawings which contain match lines I would like to have the match line text automated. For example if I'm on layout called PP02 there would be two match lines in the drawing one would read MATCH LINE PP01 and the other would read MATCH LINE PP03 this lisp routine returns the correct variable but how do I loink this to a fiels?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Script For Inserting Ladders

Feb 14, 2013

Is it possible within ACADE 2011 to use a lisp command to create a ladder with a set spacing, ladder # scheme, and rung spacing?

Typing AELADDER into the command line brings up the dialogue box where you can fill out the above information, but typing (command "AELADDER") returns an error. I'm not sure if that error is because it doesn't recognize it, or if it's because I don't have any variables after "AELADDER".

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting With An Align Parameter

Jul 9, 2013

Using lisp to insert a dynamic block that uses an align parameter. I have a rather elaborate lisp program that I am adding to so that it can insert one of my library blocks which contains an alignment parameter. It sure would be nice if the alignment could be automatic and not involve additional user input.

What I am hoping for would be a way to allow the alignment parameter to do its job when inserting with the following line of

(command "-insert" BLK-N-PTH ins 1 1 rot)

I was catching the rotation value of a "parent" dynamic block by using vla-get-rotation and then correcting for UCS and converting form radians to degrees, and this works well for straight blocks, but some of my blocks are curves and the whole paradigm falls apart with then.

So far my workaround is to have the user also pick the rotation, which does seem to work:

(command "-insert" BLK-N-PTH pikpt 1 1 (while (eq (logand (getvar "CmdActive") 1) 1) (command pause) ))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Attribute Values Into MySQL

Jan 18, 2012

How to connect to MySQL database and insert data from a set of blocks containing attributes?

Something like:

block 1:

- x coordinate;
- y coordinate;
- handle;

block 2:

- x coordinate;
- y coordinate;
- handle;

block 3:

- x coordinate;
- y coordinate;
- handle;

I've just got the second part (retrieving info from the blocks), but when it comes to connect to the DB I'm completely lost.

For the DB I'm using XAMP for Windows, thus using localhost, user ('user123'), pass ('pass123') and table ('table123'). The table has ID (PriKey and AutoInc), px, py and hdl fields.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Blocks Not Inserting Properly Through Program

Oct 13, 2011

Have an AutoLisp program that inserts a block with attributes. Been using it forever. Yesterday I ran the program and somehow when the block is inserted, it skips the Y scaling factor. The program should insert a block at a point with a X scale of 19.2, Y scale of 19.2, Rotation at 0 and then four attribute values.

What is happening is the block is inserted at the correct point and X scaling factor, but the Y scaling factor goes in for the Rotation angle (19.2 degrees), the Rotation angle goes in as the first attribute and the remaining attributes are shifted over and the last attribute is missing.Line of code is:

(command "INSERT" "CNVTAG" inspt scl scl 0 text1 text2 text3 text4)

The command prompt displays:

Command: (command "INSERT" "CNVTAG" inspt scl scl 0 text1 text2 text3 text4)
INSERT Enter block name or [?] <NEWWHDBORD>: CNVTAG
Units: Inches   Conversion:    1.0000
Specify insertion point or [Basepoint/Scale/Rotate]: Specify scale factor <1>:
19.20000000000000
Specify rotation angle <0>: 19.20000000000000
Enter attribute values
Conveyor number: 0 Conveyor Speed: 5315-BCS Motor Horsepower: 1.5hp Release
Mode: 45/90fpm

I looked at the system variables INSUNITS, INSUNITSDEFTARGET and INSUNITSDEFSOURCE AND THEY ARE ALL SET AT 0..Currently using AutoCAD 2010.

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

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 :: How To Get Viewport Scale

Feb 2, 2012

I am adapting a routine by Alan J Thompson found here for placing an outline of a paperspace viewport in modelspace.

I have added some lines for making a suitable No plot layer with appropriate linetype, and wanted to make the lwpolyline have a thickness dependent upon the viewport scale.

My paperspace viewport scales are set for printing via Zoom - 1/50XP for example to get a 1:50 scale plot (or 0.02XP)

Having selected the relevant viewport, I wanted to be able to determine the vp scale, but am unsure how to extract this information from the viewport entity itself.

The routine was as follows:-

(defun xpfact ()
(- (car (trans '(1 0 0) 2 3))
(car (trans '(0 0 0) 2 3))
)
)
--

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Annotation Scale To 1:2

Apr 26, 2013

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?

View 4 Replies View Related







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