AutoCAD Visual LISP / AutoLISP :: Using Insertion Point To Select Line Rather Than Using Entsel

Aug 12, 2013

We have been modifying a trim-around-block routine to have as few clicks as possible and though it feels like we'd be able to have the line to be broken auto-selected based off of the insertionpoint that was set as a variable.

;(setq pnt1 (getvar "lastpoint")
;      sst1 (osnap pnt1 "nea")
;end setq

;(setq ss (ssget '((0 . "LWPOLYLINE")))) ; limited to Polylines
; (while (> (sslength ss) 0) ; as long as there's anything in [or remaining in] the selection set))
; (setq ent (ssname ss 0)
; paramcount 1
; ) ; first entity in [or remaining in] the selection set paramcount 1); end setq
 
are about the closest snippets of code that we've managed to find but neither of these are working.

How we can force the program to break the line without the user having to select the line (because they will have already selected the insertpoint, and using osnap nearest would find the line that requires breaking)

View 9 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Modify Insertion Point Of Text

Jan 10, 2008

How do I change the insertion point of a text using "vla-put" ? I've tried using :

(vla-put-InsertionPoint en a)) with a = (4455.94 428.576 0.0)

and I get the following error:

lisp value has no coercion to VARIANT with this type: (4455.94 428.576 0.0)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find A Block And Get Its Insertion Point?

Jan 27, 2012

How can I find a block with a specific name and get what the coordinates are? What we have is our Bill of Material is attributed blocks. I am attempting to change the first one. Well all of the lines that list the parts are seperate blocks with the same name. Now the Top Line of the Bill of Material is a different named block. If I can find the coordinates of this block I can then select the first line to do what I need to.

If needed: AutoCAD 2013 User using Visual LISP for editing LISP and DCL files Also I have AutoCAD 2011 currently still available for us, but we are using AutoCAD 2013 for 99.9% of AutoCAD use

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Changing Insertion Point Of A Block?

Feb 6, 2011

I have insert blocks in my dwg. It is the circle. While creating the block, i was just pick the point into the circle not exactly at the centre.

Now i want change the insertion point of the block at centre of the circle without moving the objects from the dwg.

Beacuse i had use block editor to change the insertion point. But after changing, all blocks were moved from the original position.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Multileader Block Insertion Point?

Oct 21, 2013

My multileader style uses a block as a content. How can I find world coordinates of insertion point of block entity within multileaders?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Rounding Up Block Coordinates (insertion Point)

Sep 2, 2013

We have several AutoCAD drawings with hundreds of block references inserted with imprecise coordinates. Now we need to dimension all elements and need to correct these positions.

I am searching for a routine to round these positions up or down towards a 5mm precision so I don't have to manually move every single block element.

Is there any way to automate the task or do you know any workaround (like inserting the elements into a drawing with poorer unit precision settings)?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block Insertion Point Is Within A Closed Polyline

Oct 11, 2011

I've have code to test if the insertion point is within a closed polygon. But prior to testing the insertion point I use ssget to trim the selection set initially..

(ssget "CW" Pnt_List (list (cons 0 "INSERT")(cons 2 BlockName)))

this requires that the whole Crossing Polygon is visible, so I do a zoom first. This requires time. Is there a way I can do this that does not require the zoom?

View 3 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 :: Editing Multi Leader Text Insertion Point

Nov 16, 2012

Is there a way to modify the text insertion point of multileaders using lisp? We have a problem with some of our multileaders getting a landing distance set to a negative value.  My lisp routine will correct these to a default value, but then the text jumps a bit.  If I could get the insertion point prior to changing the landing distance then I could restore that point after changing the landing distance.
 
;;-------------------------------------------------------------------------------------------------(defun c:zld (/ e th dogleg doglegllength sf ss c mlss mlcount) (setqss (ssget (ssget "X" (list (cons 0 "MULTILEADER"))))DWATxtHgt (getvar "userr1")sf 1dogleg (/ 3 32.0)th (if dwatxthgt dwatxthgt dogleg)c 0mlcount 0mlss (ssadd)) (IF ss (while (< c (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss c)) c (1+ c) ) (= (vla-get-ObjectName e) "AcDbMLeader") (progn;;change the dogleglength if

[code].......

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Texts On A Line?

May 22, 2012

There is a very complecated drawing. Texts are on a line and crossing a line or something like that. Some texts has insertion points on the line. When the line is selected by LISP, only the specific texts with insertion points on the line are selected. Does it make sence?

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Line And Get Endpoint?

Feb 12, 2013

Can I select a line and get the nearest endpoint so I can do something to the line using the endpoint as a base?

It will include an ssget and an osnap "end" in the code, but not too sure how to put it together.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Entity With Options To Type In Text / Pick Point

Nov 6, 2013

I am looking for some code that would allow me to select a MTEXT Entity - or other entity -  (as the DEFAULT option) but also to allow me to type in some text manually or to pick a point in the drawing. Something that would present the user with:

"Select an object or [P to pick a point]"  or

"Select MTEXT or [M to type].

I can write some code to type in text manually as the default option and get the second option to select entity using get string and then write some condition of if code but I don't know how to do it having entsel as default option.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Dynamic Block Based On Previous Selected Point

Apr 9, 2012

For a program i am working for i have to extract the base point of a dynamic block.

This can be done perfectly by this function:

(cdr (assoc 10 (entget (car (entsel)))))

But i want the entity selected based on a previous slected point. So for example when i selected pt1 (which is a point at the border of the dynamic block) i want to be able to extract the base point on the block whit this point.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Select All Layers Using Command Line

Nov 23, 2011

How I can select all layers using the command line?

I am going to write a piece of lisp which will reset all the lineweights for all layers to default and have started by doing it manually on the command line to see what I need to automate.

To start with I choose -layer then LW  then type default and it is here I have a problem.  It asks enter name list of layers for lineweight default  which is where I need to choose all.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Line With Previous Middle Point

Jun 5, 2013

why do not draw the line between ptm1 and pt3?

(defun c:PUNTOM (/ pt1 pt2 pt3) (setq pt1 (getpoint "
Initial point : ")) (setq pt2 (getpoint "
Final point : ")) (setq pt3 (getpoint "
Offset : "))(setq ptm1 (mid (pt1 pt2))) (command "_line" pt1 pt2 "")(command "_line" ptm1 pt3) (princ));;;;;;;(defun mid (p1 p2) (list (/ (+ (car p1) (car p2)) 2.0) (/ (+ (cadr p1) (cadr p2)) 2.0) ));;;;;;;;

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block With Pick Point On Line Prompt?

May 8, 2013

I have a lisp routine that I would like to add to. Right now when running the macro the user is not prompted to "Pick Point On Line" in this example

(command "insert" blk "s" var1 pause pause))

I have added the line

(setq pt1 (entsel "Pick Point On Line "))
(command "insert" blk pt1 "s" var1 pause pause))

but the command doesn't seem to like my PT1 value

BLK and VAR1 are set in another lisp routine.

View 9 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 :: FAILSAFE Basic Block Insertion?

May 20, 2013

I need a function that accepts a block name as an argument and will insert the named block without fail no matter if the block was made to scale uniformly or not.

How can I determine if the block should be inserted like:

(command "-INSERT" blkn "0,0" 1 0)

or:

(command "-INSERT" blkn "0,0" 1 1 0)

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Block Layer After Insertion

Mar 7, 2013

wondering if is possible to have a lisp routine to:After use the INSERT command, the routine will automatically change the layer of the inserted block to a specific layer according of its name.

i.e.

Step 1 : I will insert a block named Block A using the normal autocad INSERT command (I do not want to insert the block without the Insert window dialog box)

Step 2 : After the insertion, the routine will select the last insertion (or the last object, or any other best way to select this block and will take it's name)

Step 3 : The routine has a list that says:

(If the last insertion (or object) is named Block A, put it in the layer Layer A with color Bylayer and linetype Bylayer)             

(If the last insertion (or object) is named Block B, put it in the layer Layer B with color Bylayer and linetype Bylayer)

and so on... I can make the approprieated list by myself folowing my standards.

I think it will be nice to avoid an error if the block is not in the list. So:

(If the last insertion (or object) name is not in the list, do nothing)

To finish, it will be nice to create the layer if it does not exist. Also, Unlock, Thaw and Turn on the layer if it's Locked, Frozen or Off.

View 9 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 :: 3D Point From X And Y?

Oct 9, 2013

I'm trying to find acceptable point values to feed to the vlax-3d-point function for a vla-addmtext function. With vanilla lisp I just provide the point as x y = "7/32" "2-3/8". So I assumed that I could drop a 0 in for the z like: (VLAX-3D-POINT "7/32" "2-3/8" 0).

Then I thought I was going to be tricksy and try (vlax-3D-point (getpoint)) believing that I could pick the point and get what I need to feed the function, but yet again, no deal. The command line gave me: 

node
of #<variant 8197 ...>

Nothing I can use in my code. So how do I find the point in a format that vlax-3d-point will like?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Put Point At Each End Of Arc?

Dec 19, 2011

What is the magic word for put a point at each end of an arc, the lisp I have only put a point at center of the arc.
 
(defun cAA ( / i j ss e1 e2 p1 p2 p3 points )
(if (setq i -1 ss (ssget '((0 . "ARC"))))
(progn

[Code].....

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Two Line MLEADER - Only Get One Line Of Text

Jul 18, 2012

I'm trying to write a lisp routine to create a two line MLEADER but i can only get one line of text. Creating the MLEADER manually from the command line i just have to hit enter after the first line of text to add a second line. How would i do this in a lisp routine?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select All Viewports (LSP)?

Sep 26, 2013

I have the below code, which works great accept if the layout tab doesn't have a viewport.What am I missing?

(defun ViewportLayerUpdate ()
(setq OLDcmdecho (getvar "cmdecho"))(setvar "cmdecho" 0)(setq OLDnomutt (getvar "nomutt"))(setvar "nomutt" 1)
(if (setq ss1 (ssget "X" (list (cons 0 "VIEWPORT"))))(if (setq ss (ssget "x" '((0 . "VIEWPORT") (-4 . "/=") (69 . 1))))
 (command "CHPROP" ss1 "" "LA" "0-VPRT" "") ))
(if (setq ss1 (ssget "X" (list (cons 0 "VIEWPORT"))))(if (setq ss (ssget "x" '((0 . "VIEWPORT") (-4 . "/=") (69 . 1))))
 (command "change" "p" "" "p" "color" "bylayer" "")   ))

[code]...

Factory Design Suite Ultimate 2012
AutoCAD 2012 | Inventor Professional 2012 | Vault Professional 2012

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select All In Macro

Jun 19, 2013

Trying to add this macro to a new command in my cui. Does Select all not work in macros?

^C^Clayiso;;_select;all;;_chprop;la;c-rway-x;;

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Objects With Given Xdata?

Jan 2, 2012

with a function like this I added some xdata, some MULTILEADER

(defun c:add_xdata () (princ "Select: ") (setq ogg (car (entsel))) (addXdata ogg "TEST" "CODICE" "1256") (addXdata ogg "TEST" "MATERIALE" "LEGNO") (addXdata ogg "TEST" "TIPO" "A"))
 
Now with the following function can only select leaders who have linked the xdata application TEST

(setq selez_all (ssget "X" '((0 . "MULTILEADER")(-3 ("TEST")))))
 
I can not, however, find a way to select all MULTILEADER who have a particular value of XData.

For example I would select all MULTILEADER with MATERIALE = "LEGNO" and TIPO = "A".

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Arcs By With Normal Z -1

Feb 11, 2013

Newbie here trying to learn LISP. My first program is to flip all arcs and circles that have a Normal Z property of -1. But I'm having trouble finding a detailed list of commands and functions for the LISP language that explain creating circles to selecting entities filtered by properties. I must be searching for the wrong terminology.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Last Created Dimension?

Apr 10, 2012

I have the following code, that for some reason the last created dimension is no being selected.  That's the first problem.  The second (and not as improtant) problem( becasue it does work), is that I'm using the "dimedit" command.  I prefer to do a swap within the dxf codes, that I treid but didn't work, so I resorted to the "dimedit" command.

(command "DIMLINEAR" pause pause pause)
(setq last_dim (entsel (entlast)))
(setq oldunits (getvar "lunits"))  (setq oldprec (getvar "luprec"))

[Code].....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Possible Select All ANNOTATIVE Objects In A DWG

Jun 20, 2012

is it possible select all ANNOTATIVE objects in a DWG and  to set a Viewport/ANNO scale for all  via lisp

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Color Dialog Box

Jun 21, 2013

using autolisp or visual lisp I want to open "Select Color Dialog Box" URL....and get RGB color code to my lisp.If I enter "color" in command line, i get color dialog box, but if I use this command in (command "color") I get more promts and not color Dialog Box.

I want to make a lisp routine which would ask for first color, second color and range of colors. And will calculate color range from first color to second color.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select All Anonymous Blocks

Mar 11, 2005

I want to explode all anonymous blocks, but how do I create a selection set of them.?(ssget "x" '((2 . "*U*"))) doesn't work, and is dangerous if you have any blocks with the letter 'u' in them.

View 9 Replies View Related







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