AutoCAD Visual LISP / AutoLISP :: Check Object Type Of All Objects In Model Space

Feb 25, 2013

Without opening the drawing...

How can I iterate through and check the object type of all objects in model space?  And... then delete them if they are certain types... like lines, circles, polylines, text, mtext, etc?

View 2 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Delete Objects In Model And Paper Space

Feb 14, 2013

Is there a quick way to simultaneously delete all objects in a layer if these objects are found across several layout tabs and model space?

At the moment, I'm getting the objects using: (setq a (ssget "X" '((8 . "Revision"))))

This finds all objects in the drawing, but if I just use: (command "_.erase" a "")

to delete them, only the the objects in the current layout or space are getting deleted...

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Auto Update Of XY Coord In Model Space Onto Paper Space (Layout Tab) Block

Nov 5, 2013

I've tried doing a block that automatically updates the X and Y coordinates from its moveable leader. I can get it to work in model space or paper space. But my problem is I want it to work in PS, but update with the MS coordinates through the viewport.

I can get it to update, by LISP, by picking a point and passing the points to the blocks attributes. At the moment I have a LISP when actioned it locks the viewports, activates the viewport, and asks you to select a point. Once selected it de-activates the viewport (going back into layout tab) then asks which block you want to update. Where you now select the block and it updates the coordinates.  I.e. manually pick the point in MS, switch to PS and then manually pick the block. Then I have to manually modify the leader to the correct location.

I'm hoping that I can (In PS) move the end of the leader to snap to a position in MS and the coord updates to reflect the correct MS coordinates. I'm thinking that maybe this can't be done automatically and that I maybe can move the leader but I'm not sure how I can do it without running a LISP to update the block?

I'd be happy moving the leader then just running a single command and the leader coordinates updating without having to select the points and the block again.
  
I've attached the block showing the auto update of the attributes (fields).

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check If An Object Already Has A Reactor Connected

Mar 30, 2012

how can I check whether an object has a reactor connected?

I wrote the following
 
(defun c:**** (/ ogg collegaReactor) (setq ogg (car (entsel))) (setq collegaReactor (vlr-object-reactor (list (vlax-ename->vla-object ogg)) "NOMEAPP" '( (:vlr-modified . testedit) (:vlr-objectClosed . endedit) ) ) ))(defun testedit (notifier-object reactor-object parameter-list / ogg collegaReactor) (alert "testedit"))(defun endedit (notifier-object reactor-object parameter-list / ogg collegaReactor) (alert "endedit"))
 
If I start two or three or more times the "c:****" and select the same object, when I changethe "alert" appear several times.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select And Bind All Xrefs In Model Space

Oct 9, 2012

Any code that will select all xrefs in modelspace and bind (insert) them?

the   -xref  bind command requires explicit names and if I use * it will also bind my titleblock xref in paperspace which I want to avoid.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move UCS To Front Of All Entities In Model Space

Jul 9, 2013

I have code that will set and sae a current UCS to the front of an entity, of course, depending on the viewpoint.  This is so, because we need all draft lines in front of 3D solids, such as dimensions, leaders for labels, text entities and so on (the reason for not putting these entities in paper space is another discussion ).

But I'll have on of two problems on numerous occasions:

1. The user forgets all together to run the command.
2. The user will pick the wrong entity that is in the foremost position in that view.

The code I have utilizes the following:

(setq ent (car (entsel)))

(vl-load-com)
(setq obj (vlax-ename->vla-object ent))
(vla-getboundingbox obj 'LowerCorner 'UpperCorner)
(setq LowerC (vlax-safearray->list LowerCorner))
(setq UpperC (vlax-safearray->list UpperCorner))

Then I'll analyze the X, Y and Z of both the lower and upper corners, and set my UCS to whatever is proper.

Is there a "LowerCorner" and an "UpperCorner" for all entities.  I can't see "VSMIN" and VSMAX" working because the elevation of the returned coordinates is always "0,0"

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Changing Color Of Background In Model Space

Jan 2, 2014

Any routine for changing color of AutoCAD background in model space. As for changing background color we have to follow four steps namely as follows:-

1. Execute OP

2. Go to display tab

3. Go to color tab

4. Change color

A tool that directly calls the model color shall be highly beneficial.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Link Attribute Paper To Model Space

Jan 24, 2013

Is there a way by which I can link  a paper space block attribute to model space block attribute

In other words

Paper space as a block Title and attribute "QTY"

Model space has a block X and attribute "QTY_MODEL"

Is it possible to edit "QTY" and as a result get automatic update on "QTY_MODEL"

I am not familiar with diesel/macros yet in Acad.

Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set Model Space To Display As Plot Style?

Jun 28, 2012

Is there a way to get model space to "display plot styles" through a lisp routine or a script?

i'm currently setting up a whole bunch of custom tool palettes for the company I work for and instead of the icons displaying in their actual colour (at the moment they're green, which doesn't show up very well on the light grey background), I'd rather they show in the plotstyle assigned to the individual dwg's.

call up the page setup manager (while in model space) and click modify, you can then check the radio button to "display plot styles" in the top-right corner. But when you have around 100 - 200 blocks to change, that process can be rather time consuming and cumbersome!

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Bad Argument Type / VLA-object Collection

Aug 6, 2013

I discovered yesterday my burst lisp routine isn't working. It gives the following error message:

bad argument type: VLA-object collection: #<VLA-OBJECT 0971e1d4>

The routine does not appear to have changed. But here is the
 
(Defun C:BURST (/ item bitset bump att-text lastent burst-one burst BCNT BLAYER BCOLOR ELAST BLTYPE ETYPE PSFLAG ENAME ) ;----------------------------------------------------- ; Item from association list ;----------------------------------------------------- (Defun ITEM (N E) (CDR (Assoc N E))) ;----------------------------------------------------- ; Error Handler ;----------------------------------------------------- (acet-error-init (list (list "cmdecho" 0 "highlight" 1 ) T ;flag. True means use undo for error clean up. );list );acet-error-init ;----------------------------------------------------- ; BIT SET ;----------------------------------------------------- (Defun BITSET (A B) (= (Boole 1 A B) B)) ;----------------------------------------------------- ; BUMP ;----------------------------------------------------- (Setq bcnt 0) (Defun bump (prmpt) (Princ (Nth bcnt '("
-" "
\" "

[code]....

View 6 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 :: Determine Type Of Object That User Selected?

Mar 1, 2012

Is there a way to determine the type of ACAD object that the user selected? I need to retrieve the value from either a dimension or text. The info could be in either format so the lisp routine needs to determine what was selected so the correct vla-get command is used.

Once I determine what the object is I can use an if statement to retrieve the value.

;user selects the object
(setq dimobj (vlax-ename->vla-object(car(entsel))))
;If ACAD object is a dimension do this.
(setq dimvalue (vla-get-textoverride dimobj))
;If ACAD object is text do this.
(setq dimvalue (vla-get-textstring dimobj))

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check For Last Command

Jan 8, 2014

We have developed processes, standard operating procedures, work instructions (whatever you want to call it) for several tasks we do on a regular basis.  More importantly, tasks that we don't do on a regular basis.  On some processes, performing certain commands is a critical step in the quality of the product.  I have also developed a lot of lisps to streamline these processes.  Of course there are commands that just don't make sense to try and include into existing lisps.

The problem we're having though, is that people are not following the processes.  I don't know if they think they are smarter than the process, or if they don't understand the process, or if they are just complacent.

One of the things that would really work to get everyone to follow the process, is to have my lisp routines check to see what the last entry at the command line was.

For example, if one of my lisps depended on the drawing be saved, well, instead of putting the save command in the lisp, sometimes it would be beneficial to check to see if the drawing was saved in the first place.  Kudos to those who do follow the process, they do save the drawing, and then run the lisp.  On rather large files, I would prefer not to save the drawing twice, back to back.

There are a lot more benefits to checking to see what the last user entry was, in a certain drawing. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Check Overlap

Aug 12, 2012

I want autolisp program to check overlap like in closed or open polyline with any other entity in the drawing, whether other entity is overlapping inside the polyline or not, i am beginner in autolisp and want to know exactly which functions are used or the program itself Also if possible to check circular overlap of one polyline with itself.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Contents - Check How Many Elements Are Same

Jul 10, 2012

I have a List with values shown

A=(0 0.1 0.1 0.1 0.2 0.2 0.3 0.3)

I have to check that how many elements are the same and which one is the first and the last in the same elements.

Like 1.0 is the number 1 element and third element the the 3rd element. how can i Manipulate is Visual Lisp.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check String To Set Up A Dimstyle

Nov 18, 2011

I've been working on a lisp to set up basic settings such as text styles, dim styles, discipline specific layers and things of that nature.

I have a prompt to ask for a discipline designator as a string.  I want to have an If statement or a conditional to read that string and check for a "C" if it finds it I want to have it set up a dimstyle to decimal feet ect and if not do it as architectural units.

This is just a test lisp that I'd like to add to the main one listed above...  

(defun c:test(/ disc dsnm dsna)

(setq disc (getstring "
Discipline (G,C,S,M,E,CP): "))                ;Prompt for Discipline
(setq ds (getint "
Dimscale Factor: "))                                          ;Prompt for Dimscale
[code].......

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Check If System Variable Is Read Only

Nov 22, 2012

How do I check, with LISP, if a System Variable is read only? In particular ANNOTATIVEDWG. This one is read/write when there are no annotative objects in a drawing, but read-only if there are.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Toggling Check Mark In A Menu

Oct 8, 2013

I am trying to add an on and off  checkmark via lisp to an item in a pull down menu.

It can be done with diesel but only on system variables.

In my case i can't use sysvars - only lisp.

I tried (menucmd ....) but I get nil.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check If 2 Selections Set Contain Exact Same Entities

Jul 22, 2013

I have 2 selection sets and I'm looking for a more elegant method of checking if both sets contain the exact same entities (note - the order of entities might be different).

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check If Layer Is In One Of Multiple Lists

Jul 18, 2013

I am trying to write a piece of a program that gets the layers from a drawing, and checks each one against a list of layers. If the layer is not a member of any of the lists it asks the user which layer list to add it to. This is what I have so far, but every time I try to run it I get a bad argument error.

(setq layerspresent (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))(setq i 0) (repeat (vla-get-count layerspresent)(setq thislayer (vla-get-name (vla-item layerspresent i)))(cond(((progn(or(= nil (member thislayer 0list))(= nil (member thislayer detaillist))(= nil (member thislayer clearancelist))(= nil (member thislayer clearanceelist))(= nil (member thislayer doorsdrawerslist))(= nil (member thislayer hiddenlist))(= nil (member thislayer hiddenelist))(= nil (member thislayer deletelist)))));ifs((progn(initget "0 DEtail CLearance CLEarance-e DOOrs-and-Drawers HIdden HIddEn-E DELete")(setq userchoice (getkword "

[code]...

 Depending on the user's choice the layer gets written to an external file where the layer lists get their layers from in the beginning and then adds the layer to the relevant list to use later in the program.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check To See If VIEWPORT Entities Are In Selection Set?

Nov 19, 2013

I have redined AutoCAD's copy command alias to C, but to also do other things, like set a few important variables in the background.  One of the lisps I've incororated are making new viewports, that also create layers that are visibly specific to the viewport being created.

We were tasked a while ago to do an easy job of copying entities (dimensions, text and what not) in a layout.  The problem is, users are copying the viewports too, which is bit more ineffificent than using the create viewport command I developed.

Is there a way to see if a selection set includes (0 . "VIEWPORT") entities?  If the check returns nil, well then all is good.  If the check returns "true", then I can prompt the user that a "VIEWPORT" entity is selected.  I can then exit the command, or ask the user if they are sure they want to copy the "VIEWPORT" entity.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check Attribute Of Block With External Database

Mar 2, 2013

I have a block with:

tag1: XX

tag2: YYYYYY

tag3: ZZZZZZZZ

I have an external file check.txt with string:

XXYYYYYYZZZZZZZZ

I would like to create a lisp program that check the attributes of block using an external database, if tag1+tag2+tag3 = XXYYYYYYZZZZZZZZ ok end program, if not  make a circle on block :

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: SPACE In Folder Or Path Name

Feb 12, 2013

I'm try to write a list to produce a script file!I just want to insert a dwg file in current drawing.back to MS Windows, in case of having [space] in a folder's name, we should use "" marks:

CD "Program Files"; DEL "file 10.txt"; ....

I tried both with and without "" marks but I failed!I pasted part of my code below with result of each case:

(setq TBFile "H:z.autocadA1 A2 A3.dwg")
(write-line "-INSERT" des)
(write-line (strcat "*" TBFile) des); ; *H:z.autocadA1 A2 A3.dwg  <<=should be this
(write-line "0,0" des);;insert point
(write-line "1" des);;xyz scale
(write-line "0" des);;rotation
[code]....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Remove Space From MTEXT

Apr 25, 2013

In my drawing I have lot of MTEXTS having unwanted spaces in between the text strings. 

A lisp to remove space from MTEXT. Here i am attaching sample drawing with MTEXT which is to be modify. Magenta color MTEXT need to modify like yellow color MTEXT.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Possible To Pull Out Coordinates From Object When Object Snap Applied?

Aug 29, 2011

I have a rather simple 3rd party custom object... I tried to get its bounding box but the coordinates that come back don't seem to relate at all to the object.

What I'd like are the coordinates of two nodes the object contains...

Is it possible to apply the autocad cursor in some why with the node object snap to get their coordinates?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Count Blocks In Paper Space

Dec 9, 2013

I need to count the blocks in paper space automatically. Is there any method or lisp for this.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check Current Plotter Name For Current Tab

Sep 3, 2013

Technique that can check the current plotter name for the current tab and assign it to a variable?  i.e. can it be assigned to a variable to check if if equals "myplotter1".  The next step  - is there a technique to change the plotter name to "myplotter2.pc3".

I have partially done the latter part of this in the past using the -plot command line to ASSIGN a  new plotter but I would really like to only run the routine if it really needs to.  

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Polyline Deflection TYPE Angle Table

Jul 19, 2013

The attached image shows a table that I created as a AEC Object from my Civil 3D Alignment (i can turn it to 'MText' and then 'Text' in one or two steps). What I need is a routine, or anything, that fills the third column with an information based on the second column: the deflection angle, something like that:

Curve       Angle         Type of angle

  C1       22°30'00''               2

  C2       39°21'28''               3

  C3       44°59'59''               3

  C4       45°00'00''               4

  C5       45°00'01''               5

Is there something I could read to study to solve it myself and specify my own angles/types of angles?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Error / Bad Argument Type - Code Still Working

Jul 23, 2013

My code returns the error, but it still works.

    (vl-load-com)
    (setvar "cmdecho" 0)
    (vlax-for ucs (vla-get-UserCoordinateSystems (vla-get-Activedocument (vlax-get-acad-object)))
    (setq UCSList (cons (vla-get-Name ucs) UCSList)))
    (setq FileName (vl-Filename-Base (getvar "Dwgname")))
    (setq NewUCSList (vl-remove-if '(lambda (x) (vl-string-search FileName x)) UCSList))
    (setq Listlength (length NewUCSList))

[code]....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Build Legend In Paper Space

Aug 21, 2006

Routine to build a legend in paper space

I am looking for a routine or app to pull existing MS legend symbols (inserted from the block library) from the drawing and automatically place them in a PS legend. Since I don't have a large screen and sometimes miss a symbol before running a test plot, I wish to automate the process.

I am looking for a way to populate a paper space legend with blocks inserted into the drawing for Land Desktop 2005, 2006 drawings.

I also have to replace non-conforming architectural blocks with my own, then build the legend from all drawings tabbed in the drawing file (possibly all xref drawings as well).

I liked your article on 'Selectively writing drawing blocks to any folder using VBA'. I need to brush up on my VBA 6.0 and learn VB.NET. Perhaps your code can be modified to do the task, and this would be useful to many other designers in a further article.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Animation With Shaded Solid Model

Aug 23, 2009

I am trying to do some minor animation with a shaded solid model. I have tried mslide and a script... this make s very jerky, flashing animation.

I tried a lisp routine to move the object in small increments, again the motion is very flashy and slow, as it appears to struggle perhaps with the shading.

I noticed doing a move command, and moving the same object manually, dragging the object around the screen with a mouse makes for pretty smooth motion. Way better than what I was doing.... Is there a way to do this programatically?

View 5 Replies View Related







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