AutoCAD Visual LISP / AutoLISP :: Retrieving ActiveX Selection Set

Feb 7, 2013

Tried retrieving an ActiveX selection set in AutoCAD 2013 (AutoCAD Architecture 64bit on Windows 7 is what I am using)?

Using a piece of LISP I got from the ADN developer site, it no longer works and gives this error....

Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

(defun c:erset (/ acApp acDoc selSets ss1)
(vl-load-com)
(setq acApp (vlax-get-acad-object))
(setq acDoc (vla-get-activeDocument acApp))
(setq selSets (vla-get-SelectionSets acDoc))
[code].....  

Unfortunately my lisp is very basic.

(defun c:getSset()
(vl-load-com)
(setq ss-vba (vla-item
(vla-get-selectionsets
(vla-get-activedocument
[code]......

What about creating an AutoLisp selection set from .NET - is it possible, if so I would prefer to do that instead?

The goal is to create some objects in .NET (using activeX or managed code) and then have some way to access these objects via the command line I'm assuming they only way is using an AutoLISP selection set.

View 5 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: ActiveX And Chinese Characters

Mar 26, 2013

we use AutoCAD 2013 english version also in China.

Have a look to t below process

(setq app (vlax-get-acad-object))
(setq actdoc (vla-get-activedocument app))
(setq actlay (vla-get-activelayout actdoc))      
(setq laynam (vlax-get-property actlay 'name))

 On a Chinese computer with Windows XP, the layout name via ActiveX is displayed correctly "A3 -布局-02" on the variable laynam.

But under Windows 7 64 Bit I get this "A3 -??-02". So all ActiveX objects with AutoLisp commands do not transfer the Chinese Unicode characters, also on a system in china.

But the pure lisp command (layoutlist) for example returns always the correct characters ("A3 -布局-02")

Do I need any Chinese dll’s for ActiveX dependent language? On my test PC I installed the file autocad_2013_traditional_chinese_language_pack_win_64bit in the hope I get shared files for ActiveX but this did not bring success.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Accessing Hatch Area From ActiveX

Mar 30, 2007

Hatch objects: Note To access this property, use the IAcadHatch2 interface.How can I access the Object.Area of an AutoCAD hatch. AutoCAD 2006 has properties that can be assigned to Fields so why can't I find the object att- area in any lisp vars?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Xdata From An Entity?

Mar 29, 2012

How can i build a selection set of all circles  and then retrieve the xdata attached to them? 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Entry From Entity Association List

Nov 13, 2013

presuming I have a selection set of different entities, that might have different linewight.

The code that is responsible for this property is 370

370Lineweight enum value. Stored and moved around as a 16-bit integer.not omitted from here  

I need to make all of the entities have the same layer, and to make sure the each entity has the "ByLayer" lineweight.

The problem that I encountered, is the lineweight changement.

This is the colution that I came with, but it doesn't work for me:

(defun c:test () (setq en (car (entsel))) (setq el (entget en)) (setq el1 '()) (setq indx -1) (repeat (length el) (setq indx (1+ indx)) (if (/= (nth indx el) (assoc 370 el)) (setq el1 (cons (nth indx el) el1)) ) ) (setq el el1) (entmod el) (princ) )

 Having tested it in different ways, it looks like at the end, el1 represents the association list that I want my object to have, but it doesn't want to update.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Current Paper Text Height

Oct 10, 2012

I'm looking for code to retrieve the "Paper Text Height" from the current (active) "Text Style".

View 7 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 :: 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 :: 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 :: Set Selection Set During Pasteblock?

Apr 10, 2012

I'm trying to fix an issue with entlast where if the user hits escape during the process, the wrong entity gets erased, etc.  Here's the problem code...

From a function that would have just inserted a dynamic block at 0,0 then modified it - here's where we pick up..

(SETQ ss (SSGET "L"))
(vl-cmdf "_.copybase" (getvar "LASTPOINT") ss "")
(prompt "
Pick insertion point... then rotation angle ")
(vl-cmdf "erase" ss "")
(vl-cmdf "_.pasteblock" PAUSE)
(setvar "polarmode" 1)(setvar "autosnap" 63)(setvar "osmode" osm1)
(vl-cmdf "_.ROTATE" (entlast) "" (cdr (assoc 10 (entget (entlast)))) PAUSE)
(vl-cmdf "_.EXPLODE" (entlast) ""
)

I would like to do..(setq ss (vl-cmdf "_.pasteblock" PAUSE)), but of course, that doesn't work - it returns "T".

My goal is to get rid of the entlast usage from the last two lines - unexpected cancels rotate and explode the wrong entities.

If I try (setq ss (entlast)) or (ssget "L")  after the pastblock, I might still get the wrong selection set if the user hits cancel before picking.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selection Set By Block Name?

Mar 2, 2012

I am trying to select all blocks of a certian name. I am using the following:

(setq ss1bk (ssget "_X" (list (cons 2 blkname))))

My issue is that this will not select any dynamic or attribute blocks that are not at the default insert state. 

how to select all of a block by name including reguardless of current state?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getting A Selection Set After Paste

Feb 28, 2013

Is it possible to get a selection set of what was just pasted into drawing? 

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selection Set Filter

Apr 23, 2013

I'm putting together some quick function that I can send 2 arguments and get from it the total area of a given hatch on the given layer. I think everything is in order but I'm having trouble with the selection set filter:

(DEFUN GET-HATCH-AREA (HATCH LAYR / area sset) (COND((AND(ssget "X" '((0 . "HATCH") (2 . HATCH) (8 . LAYR))) (SETQ area 0) (VLAX-FOR H (SETQ sset (VLA-GET-ACTIVESELECTIONSET (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))) (SETQ area (+ (VLA-GET-AREA h) area))) (ALERT(STRCAT "Total area = " (IF (OR (= (GETVAR "lunits") 3) (= (GETVAR "lunits") 4) ) (STRCAT (RTOS area 2) " sq. in. (" (RTOS (/ area 144) 2) " sq. ft.)") (RTOS area) ) ) ) (VLA-DELETE sset) ) ) ))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Use Selection Set For Routine?

Oct 16, 2013

with the mouse I can select objects on the screen and then start a command that uses these objects.

How can I perform this in lisp?

I can create my selection set, that's no problem, but how can I 'make it active'  for an external function?

(ssget "_C" p0 p1 '((0 . "TEXT")))
???
(c:txtexp)

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Adding To A Selection Set

Jan 27, 2003

R14 Autolisp:

I can create an empty selection set (setq EMss (ssadd)). As I loop through a list I can use the counter to create selection sets on the fly by using:

(set (read (strcat "ss" (itoa cnt))) EMss) and even keep a list of the ssets created with (setq sslst (cons (strcat "ss" (itoa cnt)) sslst)). But when I try to add an ename to the ss with (ssadd ename (read (strcat "ss" (itoa cnt))), I get a error: bad argument type (SSADD NEXTE (READ (STRCAT "ss" (ITOA CNT)))).

why I can create the sets but not add to them this way? I can add to them from the command line.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: VLA-MOVE A Selection Set?

Oct 3, 2011

I wrote a lisp program which creates a selection set using ssget. Then I use the bounding box commands to get the lowest point of that selection set. Now I want to move that selection set as a whole using the vla-move command. Can we vla-move a selection set?

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Copy Selection Set From P1 To P2?

Feb 13, 2012

I need to copy a selection set from p1 to p2.to do this I wrote the following

(defun c:test () (setq sel (ssget)) (setq p1 (getpoint "
Origine: ")) (setq p2 (gettpoint p1 "
Destination: ")) (command "_.copy" sel "" p1 p2))
 
works, but this way I can not see objects dynamically attached to the mouse cursor.

To visualize this effect, I noticed that I can use:

 (command "_.copy" sel "" pause pause)
 
but in this way I can not save the variables p1 and p2: I need for these, subsequently in the rest of thefunctions lisp.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Browse For DWG File Selection?

Apr 15, 2012

To get the 'File Selection dialog box' in AutoCAD via LISP, which command should I use other than 'GETFILED' ?

I have a program which using GETFILED to select the drawing file , but I think this dialog box size is too small to browse folder/file , as you cant see the favorites list and you cant resize the dialog box.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Folder Selection Dialogue Box?

Aug 10, 2012

I'm working on a lisp that goes through a whole list of files and does different things to those files.  I've been racking my brain for a way to select just a folder via a dialogue box, but haven't found a way.  I'm sure it can be done with dcl, but I don't know where to start. 

This would not be the standard "file" selection box, but would only list the folders and let me select one even if there are others "under" them.  This is what I'd like it to look like. 

I'm not sure if there is a standard AutoCAD box that I could call for this or not

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Dimensions And Selection Sets

Nov 1, 2011

I have a lisp routine that creates a "frame wall" and I want to be able to automatically dimension said wall within the same routine. I have created two sets of points, each set being on its own new layer. I have made selection sets of each set of points, and want to cycle through each set dimensioning as required. This what I have so far for this part of the routine:

(command "DIMSCALE" 24)
(setq sel1 (ssget "x" '("VPOINTS")))
(setq TC (polar (ssname sel1 0) (dtr 180.0) 9))
(command "DIMLINEAR" (ssname sel1 0) (ssname sel1 1)) "V" (polar TC (dtr 180.0) 9) "")
[code]...

When I run the program I get the error: bad point argument. So what I think is happening is that the ssname command is not returning the actual value but just the name? I am new to AutoLisp and even newer to selection sets so be easy... Along with this, I am also curious as to how a selection set is ordered when it is chosen ie how does it determine what would be in (ssname sel1 0). Also, how would one go about deleting the points in these selection sets after the dimensioning has been completed.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting A Previous Selection To Nil?

Jan 12, 2012

How to Set a previous selection to nil from say a move command? 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Dimension Between Two Points In A Selection Set

Nov 1, 2011

Looking to make a selection set of points that are on a specific layer, and then create a dimension between, in this case, two points. I feel like it should be very simple, but I can't get it to work for the life of me. Here is the test code I've been playing around with:

(defun c:test (/ sel1 TC)
(setq sel1 (ssget "X" '((8 . "VPOINTS"))))
(setq TC (polar (entget (assoc 10 (ssname sel1 0))) (dtr 180.0) 9))
(command "DIMLINEAR" (entget (assoc 10 (ssname sel1 0))) (entget (assoc 10 (ssname sel1 1))) "V" (polar TC (dtr 180.0) 9) "")
[code].......

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Paperspace Selection Sets

Jan 10, 2002

I wish to collect a selection set of blocks in paperspace of a certain name. For model space I would use the following line:

(setq x1 (ssget "_x" '((2 . "*etc*") (410 . "model"))))

when it comes to setting paperspace as the 410 ssget list value as the name can be modified and I need it to work in all drawings. I tried
setting a variable to the paperspace layout name and using a print function at the (410 . "model") point but without sucess.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Exploded Block Into A Selection Set

Feb 8, 2012

How to get the individual components of a block that has just been exploded within a lisp routine into a selection set. I want to alter the layer of each element to the insert layer of the block. I may also make one or two other changes according to what I find in the block.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: VLA Move With Selection Sets

Oct 3, 2011

I wrote a lisp program which creates a selection set using ssget. Then I use the bounding box commands to get the lowest point of that selection set. Now I want to move that selection set as a whole using the vla-move command. I am having trouble doing this. Is this possible? Can we vla-move a selection set? Is there a workaround?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Window Selection Of Attributes

Oct 16, 2012

I downloaded a lisp routine that will align block attributes. The problem is I can only select the attributes one at a time. I'd like to be able select multiple attributes using the selection window or a crossing window, but I haven't had much luck. If you use the AEATTSHOW command, it give you a prompt to "select using window" by pressing W. I'd like to have the same functionality for my Align attributes routine.

Below is the portion of code I currently have to select attributes one at a time:

;* Select all attributes to align with the parent selected above and add the attribute entname and the block
;* entname to a list in format ( (AttrEntName BlkEntName) (AttrEntName BlkEntName) (AttrEntName BlkEntName) )
;*
while (/= TempAttr nil)
(setq
TempAttr (nentsel "
Select Attributes to align: ")

[Code] .........

View 5 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 :: Nil Not Giving Desired Response In Selection

May 7, 2012

I use menu's based upon the following snippet:

(if (or (equal choose "1"))(MYFUNCTIONSDEFINITION))
  works a treat, its easy for me to understand even if maybe not totally orthadox in method.

So I can populate my code to have multiple selections such as follows.
 
(if (or (equal choose "1"))(MYfunctionDEFINITION1))(if (or (equal choose "2"))(MYfunctionDEFINITION2))(if (or (equal choose "3"))(MYfunctionDEFINITION3))

 and so on, but the example above caters for situations the users enter the values of 1, 2, or 3. If the user enters anything else I get a nil response from AutoCAD. So I devised the following

(if nil (alert "Wrong selection"))
  
but no response from AutoCAD qua an alert

also tried to be more in uniform with the rest of the lisp and wrote
 
(if nil (MYalertRESPONSE))(defun MYalertRESPONSE ()(alert "Wrong selection"))
 
also fails to yield the desired response.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Filter Selection Set By Substring With SSGET?

Apr 20, 2012

I have some strings like the ones below. They are always in the same format. The first line is Cold Water, the second is Hot Water and the third is Hot Water Return.

I want to build a selection set based on whether it is CW, HWS or HWR. Right now I have a routine to retrieve the string by using ENTSEL. In other words if I want to use the line of text for Cold Water I have to select it.

I'd like to be able to window them all and filter the SS for only the string containing CW and conversly HWS and HWR. SSGET function filter.

"2''CW-52.0 WSFU"
"2''HWS-48.0 WSFU+12 GPM"
"1"HWR-12 GPM "

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Make Fillet With Window Selection?

Jul 11, 2012

It's possible make a fillet with window selection?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Similar By Window Selection

Jul 30, 2013

When you select similar using  autocad it select similar in entire drawing. What i want is i am able to select similar using the same setting of selecting similar but with window selection instead of entire drawing ?

View 6 Replies View Related







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