AutoCAD Visual LISP / AutoLISP :: Copy / Move / Scale / Rotate Objects
May 24, 2002Any lisp routine where you can select objects and do a global rotate, scale, etc. from each object's insertion point ?
View 9 RepliesAny lisp routine where you can select objects and do a global rotate, scale, etc. from each object's insertion point ?
View 9 RepliesI found a program which rotates selected block(s) about thier insertion point. I modified it to rotate each of the block(s) about the y-axis. Works great. Now, I would like to change it so that it rotates a copy of each block about the y-axis and leaves the origial block in place. Its kind of like the mirror command exept it is rotating the new block(s) to the other side instead of flipping them. I want to keep all or the parameters of the block(s) the same as each original. I am using AutoCAD 2010. MOCORO is not recognized as a command. The new features workshop says to use the new command AMCOPYRM, which is not recognized either. Go figure.
(defun RotateDuplication (/ CN ENT theObjects SS)
(vl-load-com)
(setq SS (ssget (list (cons 0 "INSERT"))))
(repeat (setq CN (sslength SS))
(setq CN (1- CN)
ENT (ssname SS CN)
[Code] ......
I have the below code (from a user here on the forum) which works great for aligning text, mtext and blocks to 2 points. For annotative entities, it respects the rotation angle for mtext and text.
ie I have an mtext object at 1"=20' scale and at 1"=40' scale. I run the command when the current annotative scale is 1"=40'. The object at 40' scale has changed, but the 20' scale is unchanged. This is working as I would like it to.
But for annotative blocks, it gets weirded out. In the above example, the block at 40' will rotate, but so will the attributes at 20' scale. But linework and hatching at 20' scale will be unchanged. it looks really weird. how to get it to play nice with blocks. Ideally, I'd like the block to be at different rotation angles in different annotative scales.
(defun C:R2P (/ ss ang edata); = Rotate objects to align with 2 Points (setq ss (ssget '((0 . "*TEXT,INSERT"))) ang (angle (getpoint "
First alignment point: ") (getpoint "
Second alignment point: ")) ) (repeat (sslength ss) (setq edata (entget (ssname ss 0))) (entmod (subst (cons 50 ang) (assoc 50 edata) edata)) (ssdel (ssname ss 0) ss) ))
I have a macro that i have been using in autocad 2012 for a simple copy & rotate command as follows
^C^C_select;auto;\_copy;p;;0,0;0,0;_move;p;;\_rotate;p;;\redraw
For some reason it now does not work in 2013 the macro exits after the copy part of the macro is finished & fails to let you rotate the copied object.
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.
Any Lisp Routine to scale text objects a certain value and have the program actually scale each text object as you pick them.
The change text height using the Properties function does not work for what I need because the objects I need to scale are Mtext objects with Background Mask, and when you use the Properties function to change their text height it messes up the background mask so that you have to select each text entity and stretch the mask area smaller or larger, but if you use the scale function it scales the background mask as well so the background mask coverage is still the same.
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
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 View RelatedSay 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 RelatedI have a keyboard shortcut for Copy (see directly below). This command doesn't copy multiple. But if I type "Copy" at the comment prompt (AutoCAD 2013) the copy multiple is the default. Copymode is already set to "0".
(DEFUN C:C()
(setvar "SNAPMODE" 1)(COMMAND "_COPY")
(PRIN1)
)
I am working on automating page setups in model space and am looking for a way to set the plot scale equal to the annotation scale for scaled drawings with
(setvar "filedia" 0)
(setq a (getstring (getvar "cannoscale")))
(command "-plot" "YES" "MODEL" "" "" "" "" "" "" !A "" "" "" "" "" "" "_Y" "_N")
Setting the plot scale with !A causes the lisp to fail. However, when running each prompt through the command line individually, !A works fine. what is missing?
I would like to find a lisp that changes the scale of something that has an annotative scale and deletes all other scales in the object scale list. Often i have many different scales of existing dimensions or objects. i waste a lot of time opening the annotation object scale dialogue box, selecting add, finding my scale and deleting the old scale.
View 3 Replies View RelatedI have this snippet that inserts a block “Exit_Arrow”. The block has one attribute. Is it possible to force the attribute to remain at “0” rotation regardless what angle the bock is rotated?
(defun C:Exit_Arrow (/ LA DS)
(setq LA (getvar "clayer"))
(setq DS (getvar "dimscale"))
(C:TTEXT)
(command "._insert" " Exit_Arrow " pause DS "")
(setvar "clayer" LA)
(princ))
Is it possible to create blocks whose attributes remain at "0" rotation regardless the host block's rotation?
Lisp routine that will rotate Mtext to the same angle as the angle of a selected line and the allow you to place the mtext object where you wish.
I know there is an lisp out there called RTL that will allow you to do this with regular or Dtext, but I will not work with Mtext.
I was wondering if there is a setting somewhere that could hold my snapmode settings after I use a lisp routine. I found a lisp routine to rotate text and have noticed that everytime I use that lisp command I lose my osnap settings....
View 2 Replies View RelatedI would like to use the entmod method to rotate the text in a Multileader object. Reading the DXF code tells me the dotted pair of 42 seems to be the rotation angle, but entmoding that does nothing. Obviously I don't know how to modify this complex object.
View 3 Replies View RelatedI ment midpoint instead of center.Is it possible to select several different line entities and have them each rotated around its midpoint, or end point, so afterwards all have the same direction specified by a number or specified by direction of another entity?I wish command matchprop had that rotation option in its Settings.
View 9 Replies View RelatedI'm inserting blocks with lisp using the following code.
(defun C:test()(setq MYPOINT (getpoint "
Select an insertion point"));(command "_-xref" "attach" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" "_Scale" "1" MYPOINT)(command "insert" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" MYPOINT "" ""))
The lisp however only allows me to rotate in the x-y plane but I also want to rotate it in the z-axis hoe can I do this?
I also tryed to combine a 3d rotate to the code, as follows but to no success...
(defun C:test() (setq MYPOINT (getpoint "
Select an insertion point"));(command "_-xref" "attach" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" "_Scale" "1" MYPOINT)(command "insert" "C:/ICT/GEBERIT/XREFS/650-270-00-1.dwg" MYPOINT "" "");Rotates the item in the z axis...(setq MYANGLE (getstring "
Specify rotation angle for the Z-axis "))(command "_Rotate3D "_x" "LAST" "" "last" MYANGLE ))
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))
)
)
--
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 Relatedtake a look at the test.dwg it contains a block named 'box' (which is a rectangle) and some attributes. the annotation scale is 1:1 and i zoomed in to focus on one attribute.
change the annotation scale to 1:2 and you will see the attribute grows by 2 - that's ok! now load attmod.lsp and run attmod command and you will see the attribute grows again by 2
even the command only (entmod) the attributes without making any change.(to restore it use battman sync)Is there a workaround to this bug?
Is there a way or a lisp to scale multiple 3d polylines, at same time, and the base point is the start point of each one?
View 4 Replies View RelatedA2008. Is there a setvar, setenv, registry entry etc. that can be used to change the scale of Multileaders with annotative off to have the same effect that DIMSCALE has on Q leaders? I want to have a single scale-independent Multileader style and modify it on the fly along with DIMSCALE and LTSCALE. I'd use Qleader but UCS's do odd things to text position and orientation.
View 4 Replies View RelatedI am working on a script. I need to select all lines and polylines and set there linetype scale to 1.
I'd take a simple lisp routine if that would be easier.
I am attempting to create an AutoLISP that removes all un-used drawing scales from a file, then adds the standard scales used in civil engineering. This is what I tried using:
;;;Add Engineering Scales
(defun C:AES ()
(command ".CANNOSCALE"
"1" = 1'"
(command "-scalelistedit"
[code]...
Now, I am only a beginner to writing LISP, but I know that my problem is that it is reading the inch marks after the one in the scale name as a enter, but I don't know how to get around this. Also, I don't know how to get it to skip scales that are still in the drawing.
I would like to copy FIllet command and have multiple Fillet buttons with different radius. In the CUI file under toolbars when you right click and copy a button and then change the macro command it changes all the buttons to the same macro.
I guess it does that since when you copy a botton, the new button has the same Element ID name.
2013 Civil 3D
i want to select a block and the lisp copies TAG1 into my clipboard (i want to paste it in excel)
View 9 Replies View RelatedI 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.
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).
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 RelatedIs there any way to make a block uniform scale using lisp? and also make a block drawing uniform scale?
View 5 Replies View Related