Jump to content

Recommended Posts

Posted

This seems so trivial but I still can't figure it out.

 

This is a very basic scenario of a general problem: how do you place an object at a specific distance from a second object? Suppose I have a rectangle and want to place a circle center 3 and 5 units (arbitrary numbers) up and to the right of one of its midpoints. How do I make sure I am at the right spot? If I have OSNAPS turned on, the center is placed on the midpoint and if I have it turned off I can't easily locate the midpoint.

 

Cheers

Posted
This seems so trivial but I still can't figure it out.

 

This is a very basic scenario of a general problem: how do you place an object at a specific distance from a second object? Suppose I have a rectangle and want to place a circle center 3 and 5 units (arbitrary numbers) up and to the right of one of its midpoints. How do I make sure I am at the right spot? If I have OSNAPS turned on, the center is placed on the midpoint and if I have it turned off I can't easily locate the midpoint.

 

Cheers

OSNAP's are not needed for this. It is easy, just select the object and initiate the MOVE command, then type @3,5 and hit Enter at the command line. The "@" symbol represents the relative coordinate, the 3 is the move along the X-Axis, and the 5 is the move along the Y-Axis. Easy as pie. 8)

Posted

You're right; it is that easy. Thanks for the quick reply.

Posted
You're right; it is that easy. Thanks for the quick reply.

That's what we are here for. Come back anytime with any more questions. :thumbsup:

Posted

viperex,

StykFacE is right that it's easy to move an object incrementally, but it's always seemed to me that

there should be a direct way to pick a reference point and then offset from that. I think that only the

LINE command contains that built-in capability since you can use the last point defined as the start

point of a new line by hitting before anything else. Why the developers didn't somehow include that

feature in other object-drawing commands is a mystery to me. Maybe it's more difficult to implement than it

looks. I wrote a lisp program that draws a point at a user-picked position to set the LASTPOINT system

variable, then deletes the point. From there, you can start any drawing command and use @X,Y (or @X,Y,Z) to

draw relative to the last point. It works and does save a keystroke or two, especially if you have a free

function key to assign, but what I really wanted was some way to set the reference point 'inside' the

drawing commands. I tried several approaches, but never got it working.

 

Anyway, here is the lisp. It might help a little.

 

; ref.lsp - sets a reference point to use with a relative ( @ ) dimension offset
;           for any subsequent drawing command.
;           Use : Type REF at the command line (or assign REF to a function key)
;           and pick a reference point. Then start a drawing command and use @x,y
;           or @x,y,z for the start point, center, etc.

(defun c:ref (/ *ERROR* rpt refset gset osave)
 (defun *ERROR* (msg) 
 (setvar "OSMODE" osave)
 (princ " - interrupted function ")
 (princ)
 )  
(setq osave (getvar "OSMODE"))
(setvar "OSMODE" 37) ; set end point, center and intersection snaps
(setvar "CMDECHO" 0)
(setq rpt (getpoint "\n Select reference point"))
(command ".POINT" rpt)
(setvar "CMDECHO" 1)
(setq refset (ssget "L"))
(sssetfirst gset refset)
(entdel (entlast))
(setq refset nil)
(setvar "OSMODE" osave)
(princ)
)

Posted
viperex,

StykFacE is right that it's easy to move an object incrementally, but it's always seemed to me that

there should be a direct way to pick a reference point and then offset from that. I think that only the

LINE command contains that built-in capability since you can use the last point defined as the start

point of a new line by hitting before anything else. Why the developers didn't somehow include that

feature in other object-drawing commands is a mystery to me. Maybe it's more difficult to implement than it

looks. I wrote a lisp program that draws a point at a user-picked position to set the LASTPOINT system

variable, then deletes the point. From there, you can start any drawing command and use @X,Y (or @X,Y,Z) to

draw relative to the last point. It works and does save a keystroke or two, especially if you have a free

function key to assign, but what I really wanted was some way to set the reference point 'inside' the

drawing commands. I tried several approaches, but never got it working.

 

Anyway, here is the lisp. It might help a little.

 

; ref.lsp - sets a reference point to use with a relative ( @ ) dimension offset
;           for any subsequent drawing command.
;           Use : Type REF at the command line (or assign REF to a function key)
;           and pick a reference point. Then start a drawing command and use @x,y
;           or @x,y,z for the start point, center, etc.

(defun c:ref (/ *ERROR* rpt refset gset osave)
 (defun *ERROR* (msg) 
 (setvar "OSMODE" osave)
 (princ " - interrupted function ")
 (princ)
 )  
(setq osave (getvar "OSMODE"))
(setvar "OSMODE" 37) ; set end point, center and intersection snaps
(setvar "CMDECHO" 0)
(setq rpt (getpoint "\n Select reference point"))
(command ".POINT" rpt)
(setvar "CMDECHO" 1)
(setq refset (ssget "L"))
(sssetfirst gset refset)
(entdel (entlast))
(setq refset nil)
(setvar "OSMODE" osave)
(princ)
)

 

 

CALCAD, the variable LastPoint is not read-only. How about something like this:

(defun c:Ref (/ #Pnt)
 (and (setq #Pnt (getpoint "\nSpecify reference point: "))
      (setvar 'lastpoint #Pnt))
 #Pnt)

 

... and, since there's no command calls, you can call it transparently. :)

Posted

Wow, Alanjt, thanks for the wonderful simplification! I still can't seem to make this work transparently within a command, but that may be because I'm not using Autocad, I only have Intellicad. If it really does work transparently within Autocad, I think many Autocad users would consider that a valuable add-on.

Posted

CALCAD, I agree with you although I'm not sure how it would be implemented for some objects (eg. will the last point for a circle be the center or one of the quadrant points?)

Anyway, I'm rather new to CAD so I don't even know where to begin with the program you (and alanjt) wrote. I'll come back to it when I get the basics out of the way.

Posted
Wow, Alanjt, thanks for the wonderful simplification! I still can't seem to make this work transparently within a command, but that may be because I'm not using Autocad, I only have Intellicad. If it really does work transparently within Autocad, I think many Autocad users would consider that a valuable add-on.

:)

I started doing the same thing you were doing, except with entmakex, so I could call it transparently, when I realized what you were really trying to accomplish. I erased everything I had and scratched that out.

 

Yeah, I can't vouch for IntelliCAD, but it any lisp that doesn't use command calls can be called transparently. :)

 

Command: l
LINE Specify first point: 'ref

Specify reference point: (721.376 1274.85 0.0)

Specify next point or [undo]:

Posted
... Suppose I have a rectangle and want to place a circle center 3 and 5 units (arbitrary numbers) up and to the right of one of its midpoints. How do I make sure I am at the right spot? If I have OSNAPS turned on, the center is placed on the midpoint and if I have it turned off I can't easily locate the midpoint.

 

Cheers

 

Select the rectangle, move, pick your point on the rectangle that you are using to place it, the type TK and hit enter, this brings you into temporary tracking, now select the center of the circle drag your object in the direction you want to move it, enter your 3 and 5 units up and enter, then drag you rectangle to the right and enter your 3 and 5 units again and hit enter, now you have to hit enter a second time to end the temp tracking command and you are done. It sounds line a lot I know but it all only takes 3 seconds.

Posted

Now I'm slightly embarrassed to say that I recommend NOT using the lisp (REF) discussed earlier.

I've since noticed that the built-in command IDPOINT (the usual alias is ID) sets the LASTPOINT

system variable without adding or selecting any particular object in the drawing. This is,

I think, the simplest way to set a reference point for a subsequent relative position.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...