AutoCAD Visual LISP / AutoLISP :: Move Existing Objects To Snap Grid?
Dec 22, 2012
I have a slightly unusual query that I can't seem to find a solution for elsewhere. I have an existing OS plan that is 'off grid', and would like to adjust the vertices at the ends of all the existing lines and polylines so that they all sit on a grid point, ie round all vertices to the nearest whole number. Is there a quick command or script that does this?
View 2 Replies
ADVERTISEMENT
Nov 28, 2012
Is there a LISP code for disabling OSNAP for specific objects or layers? An automatic disable for multileaders would be useful when fine tuning the text placement. Trouble is you need the snap for the leader end. Maybe you could disable the snap for the text grip only.
View 1 Replies
View Related
Nov 23, 2012
I need a program to move some selected text to a line something like as extend command but for text objects!
suppose that there is a horizental line (y=constant) or vertical line (x=constant) and some selected text(or other objects), I want a lisp program that move these selected text (or objects) by their "insertion point" to this line.
in other word, if the selected base line is horizental (y=constant) then property of "Y" of all selected text should change to line's "Y"; and if selected base line is vertical (x=constant) then value of "X" of all selected text should match to line's "X" value.
for example, for base vertical line (x=constant) and 3 selected text(or can be any object) result is:
text1. | text1.|
text2. | ===> text2.|
text3. | text3.|
| .text1 |.text1
| .text2 ===> |.text2
| .text3 |.text3
View 9 Replies
View Related
Dec 22, 2012
I have a slightly unusual query that I can't seem to find a solution for elsewhere. I have an existing OS plan that is 'off grid', and would like to adjust the vertices at the ends of all the existing lines and polylines so that they all sit on a grid point. Is there a quick command or script that does this?
View 2 Replies
View Related
May 24, 2002
Any lisp routine where you can select objects and do a global rotate, scale, etc. from each object's insertion point ?
View 9 Replies
View Related
May 31, 2012
I'd like to have/write a lisp to change all objects on layer "0" to layer "PC - Module"
If possible also;
save the document close the document open next in directory run layer changer program again.
View 8 Replies
View Related
Jun 20, 2012
Say I have 2 items, one is on layer "M-Duct" and the other on "M-Pipe" (they are in the same drawing). Any lisp routine that would create the layers "M-Duct-New" and "M-Pipe-New" (based on the same color and LT as the original layers) and then move those objects to the newly created layers?
View 9 Replies
View Related
Jun 9, 2004
how to check snap errors in drawing in a specified layer against some other layer. means first layer should end with second layer otherwise place error.both layers have linear features.
View 7 Replies
View Related
Apr 9, 2010
Any way to snap to, create nod, or almost anything to the centroid of a region. I create a region then have to go to massproperities then polyline command then highlight the x value and right click and paste to cmd line then the y value the same way. If there is a way to shorten the process that would be great.
View 9 Replies
View Related
Feb 10, 2009
Im using AutoCAD 09 for the first time and need to find out how to customise my snap commands to F keys. I've been using 2004 and it was really easy. 09 seems to not allow it?
for example i set F4 to end point and F5 to intersection point etc. it saves using O snap or a tab. just L, F4 and its done (for example)
View 4 Replies
View Related
Mar 21, 2007
I have this routine for using a selected arcs rad value as a new fillet rad. If you like, a "match fillet" routine:
;Fillet Copy
;Copies the Radius of an Existing Fillet or Arc;
(defun C:filletcopy ()
(setvar "cmdecho" 0)
(setq c1 (entsel "
Select Fillet to Copy:"))
(setq c1 (entget (car c1)))
(setq rad (cdr(assoc 40 c1)))
(setvar "filletrad" rad)
(princ "
Select Lines:")
(command ".fillet" pause pause)
)
I use the routine loads but could modify so it would pick up the value of a filleted polyline? As it stands it can only select an individual arc. I would like the routine to be able to pick individual arcs and/or filleted polylines, without exploding first, if possible....
View 9 Replies
View Related
Dec 27, 2011
I want to make a block which is visible to snap only on a special point, say pivot point.
View 7 Replies
View Related
Jan 29, 2012
I am using the following function to create a block:
(defun crea-blocco (ip blockname gruppoogg / blkobj sArray c r vla-objects doc) (setq c -1) (repeat (sslength gruppoogg) (setq r (cons (ssname gruppoogg (setq c (1+ c))) r)) ) (setq r (reverse r)) (setq vla-objects (mapcar 'vlax-ename->vla-object r)) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq blkobj (vla-add (vla-get-blocks doc) (vlax-3d-point ip) blockname)) (setq sArray (vlax-safearray-fill (vlax-make-safearray vlax-vbObject (cons 0 (1- (length vla-objects)))) vla-objects)) (vla-copyobjects doc sArray blkobj) blkobj)
But if I start this function two times with the same block name, I get a block with the selected objects added to the existing block.
How can I redefine an existing block with vlisp?
View 9 Replies
View Related
Mar 19, 2012
Any way to override existing AutoCAD commands.
Lets try this. When a user types "line" at the command prompt, or hits the "line" button on the toolbar, or chooses "line" from the draw pulldown menu, is there any way I can re-write what line means and draw a circle? (Extreme example)
There are just some commands that I'd like to have a variable set in the background, depending on what the command is. So I'm thinking if I could re-write the "line" command, instead of trying to convince everyone to use and remember a custom command, it would be much more efficient. There are lisp files already loaded in their start-up suite. Not sure if that works.
View 4 Replies
View Related
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
Jan 1, 2014
I have this code to draw grid lines within a rectangle:
;Variable settings(defun var_set () (setq *var_lst* '("cmdecho" "osmode" "expert" "plinewid" "dynmode") *var_usr* (mapcar 'getvar *var_lst*)) (mapcar 'setvar *var_lst* '(0 0 2 0 0)) (vl-load-com))(defun var_reset ()(mapcar 'setvar *var_lst* *var_usr*)) (defun *error* (msg) (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" "" nil)) ) (princ (strcat "
Error: " msg)) ) (and ;(vl-bt) (var_reset) ) (princ) ) (defun string-list (data) ;by lee-mac @theswamp (if (vl-string-search "@" [code].........
The above gets me the grid lines; but I have a block inserted at both ends of the grid line; how do I get the selection of those entities (selection set "frame") after each array?
or I would need to map a point list and draw each grid individually how do I go about that?
Attached is the sample of the output I'd like to achieve using LISP.
View 3 Replies
View Related
May 21, 2013
I'm working out a LISP for searching my entire drawing for a MLeader with a given value and then do something if it is found.
Currently, my code dies with
; error: Automation Error. Description was not provided.
I do not know what is going wrong & I don't know what must be done next.
(DEFUN ML-SRCHSTR (TXT LBL / SS n_txt_LBL ENT P1 P2) ;|(ML-SRCHSTR TXT)|; (IF (SSGET "x" '((0 . "MULTILEADER"))) (PROGN (SETQ ss (VLA-GET-ACTIVESELECTIONSET (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))) (VLAX-FORent ss(IF (VL-STRING-SEARCH txt (STRCASE (VLA-GET-TEXTSTRING ent))) (PROGN (VLA-CLEAR ss) (INITGET 1 "Yes No") (SETQ n_txt_LBL (STRCAT "
=>> " LBL " Label EXISTS! Add another " txt "? ") y_n (GETKWORD (strcat n_txt_LBL " [Yes/No]: ")) ) (IF(= y_n "Yes") (PROGN (ppa-L-
[Code]...
My MLeader has a _TagBox & it is the attribute of the _TagBox that I am trying to check/compare the "txt" value.
View 8 Replies
View Related
Oct 24, 2013
Is there a way to attached an already exisiting placed block to a leader. If so, is there a way to do it to all the existing blocks, that are of the same block definintion, at once?
View 2 Replies
View Related
Mar 2, 2013
Lisp file to get serial letters and numbers from existing ones,
I got a lisp file (attached) from experts in the form which does generate serial letters and numbers from existing ones.
The issue with this lisp file is that it doesn’t give the opportunity to choose the direction of numbering (top to bottom/bottom to top/left to right/right to left) as shown in the screenshot below
How this lisp can be developed to give the user the chance to choose the direction of numbering?
View 9 Replies
View Related
May 2, 2013
Is there a way to modify the existing Parametric Parameters that are in the Parameters Manager using LISP?
View 2 Replies
View Related
Jan 29, 2012
I'd like to pass and existing set of selection to a command like laylck, which asks for selections after beginning the command.
It must be possible to do this. Some CUI setup, lisp routine?
View 3 Replies
View Related
Oct 4, 2012
I have attached 2 lisp files. datblkx5 makes a block of selection, inserts the block with a 5x distortion, explodes it, and corrects the text for width factor and text height. This one works fine.
I wanted to add the feature of scaling my selection with a user input value. This is the lisp datblkxxx. This one doesn't work. (that is it doesn't correct the text for width factor). I can't figure it out.
View 3 Replies
View Related
Aug 2, 2012
i have a situation that i need to mirror a lot of MTEXT exisiting in my drawing with following needs ( as attached CAD file) :
- MIRRTEXT = 1
- original text retain not deleted.
- mirrored texts become on another layer with another color.
- mirrored texts exactly become over the original text.
View 1 Replies
View Related
Jun 20, 2011
I'm trying to define a grid based on polar coordinates.
Can be produced using the following MATLAB
n=1:50000;r=sqrt(n);t=360/((sqrt(5)+1)/2)+1)*pi/180*n;plot(r.*cos(t),r.*sin(t),'o')
I need to insert points based on the polar coordinates defined by the equations. I knew a little bit of LISP 10 Years ago, now it's a total blank. I've been trying to write a script to make this work but after 5 days I'm still without sucess.
View 8 Replies
View Related
Jan 18, 2012
The crux of the matter is that the CANNOSCALE value needs to match an existing named scale. This lisp is part of a bigger lisp and I need to pass a variable into it. Here's what I have:
(setvar "CANNOSCALE" (strcat "1" = " (rtos variable 2 0) "'"))
But I get this error when I try to run it.
; error: bad argument type: numberp: nil
View 3 Replies
View Related
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
Jan 22, 2013
I have a lot of drawings with two tables in them, and they are all over the place.
I'm able to change the columns widths using the following
(setq PipeList (vlax-ename->vla-object (car (entsel))))
(vla-setcolumnwidth PipeList 0 0.25)
(vla-setcolumnwidth PipeList 1 0.25)
(vla-setcolumnwidth PipeList 2 2.0)
(vla-setcolumnwidth PipeList 3 1.5)
(vla-setcolumnwidth PipeList 4 1.625)
(vla-setcolumnwidth PipeList 5 1.0)
(vla-setcolumnwidth PipeList 6 1.75)
I'm wondering if I could modify the assoc 10 value to a specific point of '(8.5 10.3675 0.0).
View 3 Replies
View Related
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
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
Feb 7, 2012
I use the following code to assign a reactor to an object:
(setq marReactor (vlr-object-reactor (list (vlax-ename->vla-object oggmar)) "TEST" '( (:vlr-erased . reactor_upd) (:vlr-modified . reactor_upd) ) ))
"reactor_upd" is the name of the function that starts every change or delete the object.
I would like to exclude the command "MOVE", ie if I move the object, I do not want that part to the"reactor_upd" function.
View 2 Replies
View Related
May 31, 2012
I have some general knowledge in lisp coding. But I can't seem to figure this one out (even to get started). What I want to do is make a lisp that:
- selects a line
then
- select any amount of text (any type)
then
- moves all the text to that selected line without rotating the text
if a line is perfectly horizontal then move the text of the y axis.
if the line is vertical then move the text of the x axis.
or there can be a prompt asking the user to chose the angle or axis in which the text will move (say if they want to move the text to a slanted line, you can choose to move the text on an angle, while keeping the same format and not rotating the text, or you can ask the user if they want to move it only vertically or horizontally)
I would really like the code to integrate into my autocad.
See pictures
View 5 Replies
View Related