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


ADVERTISEMENT

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 :: How To Create Selection Set Of All Entities Inside Unnamed GROUP

Jan 17, 2012

I am trying to create a selection set (or LIST) of all objects inside a unnamed GROUP.

I found a means to access the unnamed group, however I am having trouble creating the list.
 
Command: (entget (cdr (assoc 350 (dictsearch (namedobjdict) "ACAD_GROUP"))))((-1 . <Entity name: 7efe6280>) (0 . "GROUP") (5 . "130") (102 . "{ACAD_REACTORS")(330 . <Entity name: 7efe5c68>) (102 . "}") (330 . <Entity name: 7efe5c68>) (100 . "AcDbGroup") (300 . "") (70 . 1) (71 . 1) (340 . <Entity name: 7efe6268>) (340 . <Entity name: 7efe6260>))

In the example above, there are 2 entities in the group.

What I want to do is to remove a certain entity from the GROUP, then delete the entity.

Repeat until all entities of that type are removed (I can figure this part out...).

How do I create a Selection Set (or LIST) of all entities inside a GROUP?

To access the first GROUP name in the dictionary:

(cdr (assoc 3 (dictsearch (namedobjdict) "ACAD_GROUP")))

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Deleting Last Inserted Entities

Jun 2, 2012

This is what i would like to make a lisp for: if the user gives the number tree the last tree inserted entity's are deleted. If the user gives the number four the last four inserted entity's are deleted.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Exports Entities From One Drawing To Another

Oct 2, 2011

I know through the block command you can write out a selection of entities to a single drawing.But what I am wondering is if it is possible to have two drawings open, and transfer data quickly between the two?

As an example as we are detailing an assembly we create a title block around a detail, put dimensions and notes on as needed and would then like that to be transfered into another drawing next to the previously transfered detail drawing.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Detect The Blocks Which Has No Sub Entities

Nov 27, 2012

I want to code this lisp. The problem which I face is, In some drawings which come from the client, there are a lot of blocks.

I want to detect the blocks which has no sub-entities (but attribute) and add a rectangle inside this block, If it is an attribute add a line from 0,0, to insertpoint of attribute.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Copy / Move All Entities In Two Coordinates

Jul 16, 2013

I am having nearly 1000 drawings where I need to change the title block in a new format.

I am stuck up in moving all the entities  in  cordinates 15,280 (upper point) and 205,55 (lower Point) to 275,294 (upper point and correspoing lower point.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Polyline Which Point From Sub-entities Possible?

Jun 28, 2013

I continue learning....

(setq ins (vlax-ename->vla-object ( ssname sele cod)) nombre (vla-get-name ins) ) (setq bloque1 (vla-item (vla-get-Blocks (vla-get-Document ins) ) nombre ) ) (setq s_ent1 (vla-item bloque1 1)) (setq pt1 (vla-get-startpoint s_ent1 ))(setq pt2 (vla-get-endpoint s_ent11 ))(setq s_ent2 (vla-item bloque1 2)) (setq pt3 (vla-get-startpoint s_ent2 ))(setq pt4 (vla-get-endpoint s_ent2 ))(command "_pline" pt1 pt2 pt3 pt4 "c")

Why dont draw de _pline?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Make One Single Block Containing All Entities

Aug 16, 2013

I have a lisp that draws variety of entities such as lines, arcs, hatches, points, blocks, text etc. How can I make one single block containing all of them, i.e. one block that has all items drawn since the lisp was invoked.

View 8 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 :: 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 :: How To Find The Fore-most Point Of A Group Of Entities

Feb 15, 2012

I have a lisp routing that the user has to use, to create a ucs, that is exactly on the front of the entity the user selects, so that whne they are drafting, labeling, dimensioningn the 3D entity, none of the drating lines are hidden when plotted.

The code is as follows:

(setq obj (vlax-ename->vla-object ent))

(vla-getboundingbox obj 'LowerCorner 'UpperCorner)

(setq LowerC (vlax-safearray->list LowerCorner))

(setq UpperC (vlax-safearray->list UpperCorner))

[code]...

Then I do a condition to see which points are greater than others, and move the ucs depending on the view to the foremost point.  The program works perfectly.... however, often, they forget to use it.

I was wondering if I could incorporate it in another lisp that everyone uses, but not having the user pick the entity they want to be in front of (sometimes they pick the wrong entity).  Instead, take the group of entities (anywhere between 1 to 30 per drawing (these are piping spools, so the entity count is not that great in model space)) and set a front working plane in model space.  Working in paperspace is not an option, we're just too deep into our templates and processes.

I know there is a vmin and vmax, but they are for the X and Y axis, a VMax along the Z-axis would be great.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating And Modifying MESH (SubDSurface) Entities?

Dec 25, 2012

I have uploaded the handout for my AU2012 class to Google Drive. The link is [URL] It contains the detailed explanation for all the source code used in entmake-ing and entmod-ing the new MESH (aka Subdivision Surfaces) entities. [URL]

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Number Of Entities In Dynamic Block

May 19, 2013

I am modifying stuff in a dynamic block insert entity. There is no "endblk" entity at the end of these definitions and I need to cycle through every entity within the block definition. When it gets to the last entity,  I get an error because you cannot entnext passed the last entity. There are 2 things:

1. How to retrieve the # of entities in a block without cycling through it.
Or
2. A quick lesson in the *error* function, I cannot figure out how to implement this. I basically want to to say:

(if (entnext myent)) returns a error, don't abort & continue on.

View 4 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 :: Connect Two Points With Given Elevation Following Surface File / Entities

Dec 4, 2013

I am working on a flood inundation, I would like to find a lisp or command(i'm not finding) to connect two points with a given elevation following the surface file or surface entities. 

here is a small section as example right now it's just guesswork, some of these have taken a week to connect all the sections.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Zoom Layout (Entities Or Insertion Point Extents)

Oct 12, 2012

I have a drawing with various layouts that when I do a Zoom Extents the drawings is reduced to the size of a point.

I have done all the usual, ie: look for extra entities that are "out in space" so to speak and there are none.

I wonder if I have a block or image which may have an insertion point "out in space" and if this may be the issue.

Is there some way to Select all entities or Blocks (insertion point) that may exist outside a particular area ie: drawing limits.

View 3 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 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 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 :: 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 :: Remove A Selection Set From A Selection Set

Nov 15, 2013

I've created a lisp that draws the boltholes of a pipe flanges, using the correct number of holes, at the correct diameter at the correct bolt-hole diameter and then rotates.  Everything works seamlessly, when i do just one flange.  But I've discovered that fewuently there will be mulitple times when a user will have to perform the command.

So the idea I had was to do the following:

Select all circles with     (setq CirclesFirst (ssget "X" (list (cons 0 "CIRCLE"))))

Go through the code to create the new circles.

Select all circles with     (setq Circles (ssget "X" (list (cons 0 "CIRCLE"))))

Remove selection set "CirclesFirst" from "Circles".

But what for some reason (command "_.select" Circles "R" CirclesFirst "") does not work.

View 9 Replies View Related

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

AutoCAD Visual LISP / AutoLISP :: How To Regen Viewport

Jan 2, 2000

I'm trying to regen a viewport with Visual Lisp, with this code

(setq acadobject (vlax-get-acad-object))
(setq activedocument (vla-get-activedocument acadobject))

when I issue the next code

(vla-regen activedocument acActiveViewport )

I get the following error

*** ERROR: AutoCAD: AutoCAD is currently busy.

What is missing in my code?

View 1 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 :: Select Non-solid Entities On Solid Layer

Mar 19, 2012

We have this need to have all of the solids in a drawing to be placed in the "solid" layer.

Sometimes folks are drafting lines to develop these solids, and keeping the lines on the "solid" layer, rather than moving them to another layer, or deleting them altogether.

I could get folks to run this command before leaving the drawing.

I'm thinking something along the lines of:

Select all entities that are on the solids layer that are not solids.

If nil, great, do nothing.

If entities are selected, let me do something with them.

I'm hoping the following can be modified ever so slightly.

 (setq non_solid (ssget "X" (list (cons 0 "3DSOLID")(cons 8 "solid"))))

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Field Update Customscale Viewport

Feb 22, 2013

I'm trying to create a field in a block (titleblock) that will automaticly update when I change the viewportscale.It's mostly only 1 viewport, sometimes a second of even 3rd but, they are not important to the titleblock.

I've read aboud fields and diesel expressions. I've tried and it works. there is only 1 problem,It only works with the object (when field expresssion, object, custom scale) in this case the viewport pressent at that time. 

When i use the same field with the same expressions, it does not recognize the viewport/object.Is there a way to make the field, diesel expression or even something else, work without it's need for a

object name. Perhabs that the expression gets the viewportname from a lisp, something like: (setq ss(ssget "X")) ;some thing like this Can it be done?

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find One Of Corners Of Viewport Outline

Feb 2, 2012

Further to my earlier topic for getting the viewport scale which has been nicely solved, I am looking for a way to get one of the corners of the viewport outline 'drawn' in modelspace so that I can add the name of the spcific layout Tab to which it relates in a location that suits the drawn outline.

The code that I am adapting came from the thread titled Outline projection all viewports to model..The routine appears to pick up the corners of the viewport in paperspace and tranform/translate them to modelspace co-ordinates.

  (defun _trans (p) (cons 10 (PCS2WCS p ent))) (defun _cornersFromBBox (o / a b) (vla-getboundingbox o 'a 'b) (setq a (_trans (vlax-safearray->list a)) b (_trans (vlax-safearray->list b)) ) (list a (list (car a) (cadr a) (caddr b)) b (list (car b) (cadr b) (caddr a))) ) (if (setq ss (ssget '((0 . "VIEWPORT"))))
[code]....

View 4 Replies View Related







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