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


ADVERTISEMENT

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 :: 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 :: How To Properly Link To DCL

May 27, 2012

The problem I'm having is that even if I try using the most basic code, taken from this tutorial:

[URL].........

I still get an error as if the dcl file didn't exist. Both the lisp and the DCL files are both set in the same folder, together, no sub-folders or anything like that.

Here's my

- DCL:

samp1 : dialog {
label = "Structural Holes";
ok_cancel;
}

- LISP

(defun C:samp1()
(setq dcl_id (load_dialog "C:UsersEugen IancuDesktoplearnLispsamp1.DCL"))
(if (not (new_dialog "C:UsersEugen IancuDesktoplearnLispsamp1.DCL" dcl_id))
(COMMAND "ZOOM") ;;THIS IS WERE MY FUNCTION GETS STUCK. I ADDED THIS SO I COULD [code]......

View 5 Replies View Related

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 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 :: 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 :: 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 :: 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 :: 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 :: 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 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 :: Set ByLayer Routine Won't Execute Properly

Jun 19, 2013

Me and a friend are trying to work on a LISP routine to select objects in a drawing and change their attributes to "ByLayer" and other things. He is a familiar with the AutoCAD commands, I have a general idea of how to use LISP and we're trying to put our heads together to solve some workflow issues at our job.

-aDiagram
 
(defun c:set23 ()(setq uecho (getvar "cmdecho"))(setvar "cmdecho" 0)(command "setbylayer" "al" "" "n" "y")(command "-layer" "c" "23" "*")(command "-xref" "d" "*")(command "-purge" "al" "" "*" "n")(setvar "cmdecho" uecho)(princ))

View 8 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 :: Pausing In A Program To Allow Printing?

Jun 13, 2013

I have a lisp program which will create a cover sheet for my electrical drawings by extracting data from the title block. Once this is done, I manually print the cover sheet.

What I would like is to create the cover sheet, have the lisp program pause, print the cover sheet, then when printing is done, quit the drawing file so the cover sheet does not remain.

I tried several approaches, but the lisp program finishes before the cover sheet prints.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program Variable Names?

Feb 28, 2012

Is there anyway to program variable names?

What I was thinking of was in a loop some times I need multiple sets of similar variables but am not sure how many sets I am going to need. I would like to be able to increment the variable names each time the loop runs.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program Hangs Up For No Apparent Reason?

Oct 21, 2013

I have an AutoLISP program that hangs up for no apparent reason. I can run the program with an Alert in the loop. The program is a sheet generator, creating a border (insert with attributes), dimensions and MultiLeaders in Model Space, then a new Layout Tab is generated and the new elements are CHSPACEd into the new layout. An Alert temporarily halts the program once the task of a new Layout is created. In this form, the program works as designed. However, if I comment out the Alert, the program hangs up as if in an infinite loop. Also, hitting Escape does not cancel the AutoLISP, I must use Task Manager to end AutoCAD instead. My computer was recently upgraded to Win7 64-bit. I'm running 64-bit versions of software. (AutoCAD MAP 2011).

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Custom CUI For Blocks

Jan 11, 2014

I was on an older cad and am now moving to 2014.. my previous cad was heavily customized the old school way, I have decided to learn the CUI (and dynamic blocks)

My old cad has blocks on a drop down menu.. click BATH menu than WC icon, a macro sets the correct layer than inserts the WC.. took time to setup but pretty simple and straight forward (see attached for menu syntax). I also made a toolbar BATH and on that toolbar I made a WC icon.. that’s what I use the most

couple of questions

1) do I have to make a new command in CUI for each block to do the same thing?
2) I looked into the design center, but seems like its too many steps but it seems a toolbar with an icon on it, clicking the icon and a macro sets layer and insert block is still pretty quick..??
3) if a toolbar with an icon is still a fast and less step method, can I open the block and somehow make an icon of it? if so where do I put it?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Any Other Way To Open Up Blocks

Apr 12, 2012

I have this code w/ which I can open up Block Library Blocks for editing.  We have R2012 installed w/out VBA.Our MIS department is impossible to deal with.  We have this new fangled permission hysteria so I cannot install VBA myself.Is there any other way to open up my blocks? What I can I do instead?

(defun CpL () (prompt "...Open Library Block or Xref...")(terpri)
(setq a (entsel)) (setq b (car a )) (setq c (entget b)) (setq d (assoc 2 c))
(setq e (cdr d)) (setq ff (strcat e ".dwg")) (setq PP (findfile FF))
(setq opath (strcat "acadapplication.documents.open ""PP"""))
(command "vbastmt" opath))

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Simple Program That Changes Color Of M-leader Lines?

Mar 19, 2013

have a simple lisp (no v.b.) program that changes the color of m-leader lines in acad 2010?

IV 2010 Suite
Digital Storm PC:
EVGA & Intel components
Win 7 Pro 64 bit

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program For Cross Section By Manual Input

Jun 26, 2013

Is it possible to write a program for cross section by manual input of data like below. Objective is to draw a cross section with grid lines and labels of section data and datum value.

Program will ask for :

Datum value ?
Grid line spacing ?

Datas are :

Section Left

Chainage  5     Section value : 12.5
                10                            13.5
                 20                            5
                 23.7                         3

                and so on.....

Section Right

Chainage  5     Section value : 8
                10                    13.5
                20.5                  15
                25                      3

                30                      14

               and so on.....

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Output From MEASUREGEOM Command Back Into VL Program

Oct 17, 2011

Is it possible to get the output from the MEASUREGEOM command back into an VL program?If I use:(setq angle (command "MEASUREGEOM" "a" line1 line2 "x"),

the value of the angle is displayed on the screen but is not passed back into the program and the variable "angle" is not set.Is there a way that I can set this variable?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program To Evenly Space Objects Across Given Distance

Dec 28, 2013

I would like to write some sort of AutoLISP program to evenly space objects across a given distance.  I have attached a .pdf file showing what exactly I mean.

I would like the program to enable me to either enter or measure (via the selection of two points) the "z" distance, to enter or measure the "y" distance, and to enter the number of objects, "n".  I would then like the program to evenly space "n" objects across the "z" distance.

A program like this is, I have to be honest and say, way beyond my current capabilities.

Perhaps some initial guidance to get me going? 

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program Loop To Draw Lines With Rubberband

Oct 4, 2012

i am writing something that will draw consecutive lines with a rubberband to be used as a leader from a block's insertion point.  this:

(WHILE
 (SETQ LN (GETPOINT "
Select Next Point (ENTER to Finish) : "))
 (COMMAND "LINE" (GETVAR "LASTPOINT") LN "")
)   

works, but does not include the rubber band.  i tried:

(WHILE
 (SETQ LP (GETVAR "LASTPOINT"))
 (SETQ LN (GETPOINT LP "
Select Next Point (ENTER to Finish) : "))
 (COMMAND "LINE" LP LN "")
)   

which includes the rubberband, but will not exit the loop. The last break source in VLIDE shows that  

(GETPOINT LP "
Select Next Point (ENTER to Finish) : ") is casuing an error.  Placing
 (SETQ LP (GETVAR "LASTPOINT"))

 outside the loop causes all lines to be drawn from the same point rather than the endpoint of the previous line. 

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 :: 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 :: Set Basepoint During Insertion Of Blocks

Jan 14, 2013

would like to set a base point during insertion of one block.When not insert by AutoLISP, just type "b" to be able to change the base point.

But when I'm using an AutoLISP that inserts a block, it does not work, it interrupts the sequence of routine.

Lisp:
 
(defun c:carrobox()(setq #clayer (getvar "clayer")) (if (= unidades nil)(setq unidades "cm")).....

View 3 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 :: Parameters Dynamic Blocks

Feb 20, 2012

I'm using the attached lisp to change the parameters of a dynamic block. In particular, I use the function chgdynprop

(defun c: test () (setq oggfreccia (car (entsel))) (chgdynprop (Vlax-ename-> vla-object oggfreccia) "Distanze1"300.0))

The lisp function works properly, because if I select the block from the bar I can see that property Distanze1 = 300.0

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







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