View Full Version : Copy Divide
boofredlay
12th Dec 2006, 11:21 pm
Is there a command that allows an array that divides a distance.
For example, SketchUp allows you to copy an object, place it a certain distance away from the original, then you type 6/ or 10/ and it will divide the distance and place the objects accordingly.
I am tired of guessing at how many and how far to array an object.
I also never thought to ask until now :oops:
Thanks for any help.
Eric
Cad64
12th Dec 2006, 11:23 pm
Have you tried the MEASURE command?
boofredlay
12th Dec 2006, 11:27 pm
Sorry, do you mean in SketchUp?
I was asking about doing this in AutoCAD. My fault for not being clear :oops:
I would like to copy an object a certain distance, then have autocad place however many I decide between the two equally.
I hope that is more clear.
jamesf
12th Dec 2006, 11:28 pm
Have you tried the MEASURE command?
i believe this is correct
boofredlay
12th Dec 2006, 11:33 pm
i believe this is correct
Well I type MEASURE and I am asked to select an object. So I select the block I am trying to copy and it tells me it is invalid and exits the command.
:?
Alan Cullen
12th Dec 2006, 11:38 pm
Draw a line from the first point to the second point, then DIVIDE the line, then place your block at each of the divide points, then delete the line and the point nodes.... :)
Cad64
12th Dec 2006, 11:40 pm
Yes, I was referring to Autocad. By using the Measure command you can, for instance:
1. Create a block of the entities you want to copy
2. Draw a line to place the blocks on
3. Start the Measure command
4. Select the line you drew
5. select the block option from the command line
6. Type in the name of the block you created
7. Answer "yes" to align block with object
8. Specify the distance between each block instance
Your blocks will be placed on the line you drew and spaced out according to the distance you specified. This command is especially helpful when placing blocks along a curved path.
boofredlay
12th Dec 2006, 11:42 pm
Thanks Alan.
I use that as well as array quite a bit but I was hoping there was an easier way.
boofredlay
12th Dec 2006, 11:44 pm
Oops, spoke too soon. Thanks again Alan... and Cad64, thank you.. I will give it a go.
boofredlay
12th Dec 2006, 11:58 pm
Wow, if you have more than just the one block it goes nuts copying all the others. I should have read that you create a new block first...
This command acts just like an array command however. You give it a distance between each object.
Is there a way to get the measure command to divide the first and last point on the line rather than just follow the line or arc?
I am attaching an image of how sketchup does it.
CarlB
13th Dec 2006, 12:34 am
The divide command works similar to measure, but in it you specify "block" and "num of segments". But that doesn't quite get you what you're looking for, because it places the blocks evenly spaced to create number of segments, doesn't place blocks at beginning & end of line/polyline.
..I see the need for a custom routine coming on ......:)
Cad64
13th Dec 2006, 12:56 am
I've never used Sketch-up, but that divide command looks pretty interesting.
..I see the need for a custom routine coming on ......:)
Can't wait to see what you come up with Carl. :D
Alan Cullen
13th Dec 2006, 01:13 am
Race ya Carl.....
I'll see what I can come up with at lunch time ..... :lol:
CarlB
13th Dec 2006, 01:26 am
My contribution of the day, decided to call it "place". That's shorter than "distribute". :) It woorks similar to how booredlay describes the sketchup command, but you just pick a location for first and last object, no need to copy object to last spot.
(defun c:place ()
(setvar "cmdecho" 0)
(setq PtList nil SegTot 0 Oflag T)
(princ "\nSelect object(s) to distribute:")
(setq ss (ssget))
(initget 1)
(setq ptbase (getpoint "\nSelect base point of objects: "))
(setq Pt1 (getpoint "\nSelect starting point <use object>: "))
(if (not Pt1) (setq Pt1 PtBase Oflag nil))
(initget 1)
(setq Pt2 (getpoint Pt1 "\nPick point for last object: "))
(initget 1)
(setq NumDiv (getint "\nNumber of divisions between ends: "))
(setq TDist (distance Pt1 Pt2))
(setq TAng (angle Pt1 Pt2))
(setq Seg (/ TDist NumDiv))
(if Oflag (setq PtList (cons Pt1 PtList)))
(repeat NumDiv
(setq SegTot (+ SegTot Seg))
(setq Pt (polar Pt1 Tang SegTot))
(setq PtList (cons Pt PtList))
)
(setq PtList (reverse PtList))
(foreach x PtList
(command "._copy" ss "" Ptbase x)
)
(setvar "cmdecho" 1)
(princ)
)
Alan Cullen
13th Dec 2006, 02:16 am
****** !!!....Carl you beat me....my lunch hour has just started.....nevermind, I'll keep going and submit my contribution...:lol:
Cad64
13th Dec 2006, 02:24 am
That's pretty sweet Carl. I think I'll be adding that one to my collection. Thanks. :D
Alan Cullen
13th Dec 2006, 03:24 am
Here's my effort...based on what I understand boofredlay is trying to do..... :lol:
;; block or entities to array must be at the start point....
(defun c:pb ()
(setq ocmd (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq oblip (getvar "BLIPMODE"))
(setvar "BLIPMODE" 1)
(princ "\n Place blocks along Array Line - Dec 2006 - Alan CULLEN")
(setq ent (ssget (prompt "\n .....Select required entities or block....")))
(setq pt1 (getpoint "\n Pick start point of entities or block ...... "))
(setq pt2 (getpoint pt1 "\n Pick end point of array line ...... "))
(setq seg (getreal "\n Enter Number of segments required... "))
(setq segint (atoi (rtos seg)))
(setq dist (distance pt1 pt2))
(setq segdist (/ dist seg))
(setq tdist segdist)
(setq angrad (angle pt1 pt2))
(repeat segint
(setq pt3 (polar pt1 angrad tdist))
(setq tdist (+ tdist segdist))
(command "COPY" ent "" pt1 pt3)
)
(setvar "CMDECHO" ocmd)
(setvar "BLIPMODE" oblip)
(princ)
)
edit] ..... changed line .... (command "COPY" ent "" pt1 pt3 "")
to line.....(command "COPY" ent "" pt1 pt3) ......removed trailing ""
edit 2].....couple more tweaks...
JBullseye74
13th Dec 2006, 09:33 am
Nice Place lsp. thats also getting put on my list :D :D Thanks
boofredlay
13th Dec 2006, 03:21 pm
Hey thanks for the efforts guys... now can you tell me how to add a lisp to use it?
My knowledge of Autocad only goes so far. I was excommunicated to Datacad for more than a year. Now we are learning Revit!!! However I still have to do my landscape plans in Autocad.
Thanks a million once again.
Eric
Cad64
13th Dec 2006, 03:29 pm
First, save the routine to a folder somewhere on your system. Now, in Autocad, type APPLOAD at the command line to open the "Load/Unload Applications" dialog. Now browse to the folder where you saved the routine and select it. Click the "Load" button and then Ok to exit. Now type PLACE at the command line to run the program.
You can force the routine to load every time you open Autocad by placing it in your "Start-up Suite" or you can add it to your acaddoc.lsp file.
boofredlay
13th Dec 2006, 03:54 pm
Thanks Cad64.
BTW, it works like a charm, thanks guys.
kari_sinkko
26th Mar 2008, 11:23 am
Here to up the Anti :shock:
Can you use a "pick line" and a "set length" for the lazy cad user?
Pick line for highlighting, set length for the size of the block?
AND if you could pick a line, say, a squared angled polyline, could it change the UCS accordingly and blocks follow them around :P
CarlB, your script is very neat.
Powered by vBulletin™ Version 4.0.6 Copyright © 2010 vBulletin Solutions, Inc. All rights reserved.