How to offset object positions relative to a point with % as the reference unit?

How to offset object positions relative to a point with % as the reference unit?

Anonymous
Not applicable
2,728 Views
11 Replies
Message 1 of 12

How to offset object positions relative to a point with % as the reference unit?

Anonymous
Not applicable

Hi to everyone out there.

 

Is there a command in AutoCAD where i can offset drawing objects uniformly based on a reference point with percentage as the unit of adjustment.

 

Please see attachment for details.

 

Thank you,

0 Likes
2,729 Views
11 Replies
Replies (11)
Message 2 of 12

S.Faris
Advisor
Advisor

Use Dimensional Constraints and multiply the expression using the %(0.98 for 98%)

Constraint.png

SALMANUL FARIS

0 Likes
Message 3 of 12

S.Faris
Advisor
Advisor

Or to make it simpler Create a percentage driving dimension as shown in the attachment

Constraint.png

SALMANUL FARIS

0 Likes
Message 4 of 12

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... Is there a command in AutoCAD where i can offset drawing objects uniformly based on a reference point with percentage as the unit of adjustment. ....


 

Welcome to these Forums!

 

[The use of the word "offset" led me astray -- that command in AutoCAD isn't what you're talking about.  But in any case....]

 

There isn't one, though one could be made.  But one thing isn't clear to me from your image.  The first paragraph suggests to me that you want to Move things straight toward  the reference point [i.e. by the same percentage reduction in distance from there in both X and Y directions], but the X and Y parts at the bottom suggest [but I'm not sure] that you want, instead, to change their position by different amounts in the two directions.  Is that right?  I can also imagine that maybe you meant the X and Y as place-holders for different command names, shifting things straight toward the reference point, but with different built-in percentages to shift by in different commands.  However, that might be better handled with a single command name, having it ask  for the percentage.

 

And other questions come up.  Should the initial distance from the reference point to a given object always be to the middle  of it?  That's obvious enough for a Circle, but if [for example] it's a Block, or Text/Mtext, should it be to its insertion point instead?  That could give a very different result from using the middle of its bounding box, in both direction and distance of movement, if the insertion point isn't at the middle.  And should things remain their same size, and just Move, or should their size also be altered proportionally to the percentage of movement?  [I assume not  the latter, because that can be done with a simple Scale command.]

Kent Cooper, AIA
0 Likes
Message 5 of 12

scot-65
Advisor
Advisor
Oh, the "Big Bang Theory"?
Seems easy enough...

Specify percentage (1-99).
Select reference point.
Select objects to move.

The primary insert/beginning point would have to be
looked at a little closer (circle, line, block, text, etc...).

Ask in the Customization section.
I'm sure the folks over there can help.

POLAR, DISTANCE and command MOVE will be your friends.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 6 of 12

Anonymous
Not applicable

@Kent1Cooper Sorry for the wrong choice of word. Yes you are right, I want to change the position of the objects with respect to the reference point using a single command that i can assign the X and Y values at a certain percentage of the original distance.

 

"And other questions come up.  Should the initial distance from the reference point to a given object always be to the middle  of it?"  - The distance should always taken from the center point of any given object and also the size of object will not change, only the position with respect to the reference point.

 

Thank you.

0 Likes
Message 7 of 12

leeminardi
Mentor
Mentor

It sounds to me that the word (command) you want to use is "scale" and not "offset".  In addition, you want the ability to scale at  different percent values in x and y.

If you create a block of your collection of circles and then insert it you can specify the reference point, and different scale factors for X and Y.   In doing so, the circles will also be scaled in x and y as well.  No problem.  Simply explode the scaled block, select all the circles and then in the properties dialog window change the x and y scales to 1.

lee.minardi
0 Likes
Message 8 of 12

Anonymous
Not applicable

@scot-65 thank you for your pointers.

0 Likes
Message 9 of 12

Anonymous
Not applicable

@leeminardi sorry for the confusion on the word that used,it should be move not offset and also i can't use the scale command because i need the size of the objects to stay the same.

0 Likes
Message 10 of 12

S.Faris
Advisor
Advisor

Try this if you find this viable:(I cannot screencast currently, so I'll try my best to explain)

  • Draw a center mark
  • Now place POINTS in all the required centerpoints of your circles
  • Convert all of it into a block(make the center of centermark as basepoint of the block)
  • Now turn on INFER CONSTRAINTS 
  • Draw circles by picking on the previously drawn points. This will constrain the center of circles to each point. Try moving the block and make sure all the circles moves with it.if not constrain it using coincident constraint 
  • Now if you select the block and then increase or decrease the scale factors for X or Y from properties panel as required, it will start moving the circles towards or away from the center mark.

A sample block is attached for your reference.

 

SALMANUL FARIS

0 Likes
Message 11 of 12

leeminardi
Mentor
Mentor

@Anonymous 

You said "...i can't use the scale command because i need the size of the objects to stay the same."

 

I thought your objects were circles.  If they are more complex geometry simply make a block out of  each different object..  If the same object occurs more than once you can use the same block.

Once you have a collection of blocks then make a block out of the collection.  Now you can insert the block with a different scale factor in x and why.  This will scale the individual blocks as well.  Don't quit!  Explode the block  that is the collection of the scaled block and then select all the blocks (objects) and set their scale to 1.0 in the properties dialog box.

For example,

1. Original collection of objects converted to individual blocks.  The 5 blocks are made a "super" block.

image.png

2.  The "super block is inserted with an x scale of 2 and a Y scale of 0.5.

image.png

3. The "super" block is exploded  and the 5 blocks are selected and their scale factors are set to 1.0

 image.png

The result is the objects are their original size and shape but their positions have been scaled independently in X and Y.

 

lee.minardi
0 Likes
Message 12 of 12

Kent1Cooper
Consultant
Consultant

You certainly don't need to go to the trouble of making Blocks of everything, which Block definitions you would then need to Purge, etc., etc.  Try this [minimally tested]:

;| ShiftAboutBase.lsp [command name = SAB]
  To Shift selected object(s) relative to a specified Base point, in specified
    percentages in X & Y of their original distances from the base.
  For each object to be Mirrored, finds distance from its bounding box to
    base point in both directions, and Moves it appropriately
  Kent Cooper, 16 May 2019
|;

(vl-load-com)
(defun C:SAB ; = Shift About Base
  (/ *error* svnames svvals ss mentsel ment etype inc ent mid mentnea)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg))
    ); end if
    (command-s "_.undo" "_end")
    (mapcar 'setvar svnames svvals)
    (princ)
  ); end defun - *error*

  (prompt "\nTo Shift object(s) About a Base point,")
  (setq
    svnames '(osmode blipmode cmdecho)
    svvals (mapcar 'getvar svnames)
    ss (ssget ":L"); select object(s) to be Shifted
  ); setq
  (if ss ; object(s) selected
    (progn ; then
      (setq
        base (getpoint "\nCommon Base point center of Shifting: ")
        Xpct (getreal "\nPercentage of new position relative to base from current, in X direction: ")
        Ypct (getreal "\nPercentage of new position relative to base from current, in Y direction: ")
      ); setq
(mapcar 'setvar svnames '(0 0 0)) (repeat (setq n (sslength ss)) (setq ent (ssname ss (setq n (1- n)))) (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt) (setq mid (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2)) diff (mapcar '- mid base) ); setq (command "_.move" ent "" mid (list (+ (car base) (* (car diff) Xpct 0.01)) (+ (cadr base) (* (cadr diff) Ypct 0.01)) ); list ); command ); repeat (command "_.undo" "_end") (mapcar 'setvar svnames svvals); reset ); progn -- then (prompt "\nNothing selected to Shift."); else ); if [ss exists] (princ) ); defun -- C:SAB (prompt "\nType SAB to Shift object(s) About a Base.")

Percentages you give it can include partial percentage points [e.g. 97.5% as far away].  Giving it 100 will leave the things in the same position in that direction, giving it 0 will Move them to  that coordinate of the base point, 200 twice as far away, etc.  The routine could be made to [but doesn't yet] remember those and offer them as defaults.  It could also have other improvements, such as handling the Undo begin/end part differently [this is quickie-modified from an older routine].

Kent Cooper, AIA
0 Likes