Jump to content

Draw line snapped to 45 degrees angle of circle block


Edgtrimmer

Recommended Posts

Anyone ever come up with a good way to start a line at one of the 45 degree angles of a circle block? Easy to snap to quadrants or center.

 

Thanks for any ideas.

 

Just use OTRACKing on, with OSNAP set to center and intersection, and finally Polar on with 45 degree angles, or set to any angle needed. Acquire the center of the circle in the block, move the cursor to the edge of the circle, pick when you are there, proceed from there.

Link to comment
Share on other sites

  • Replies 39
  • Created
  • Last Reply

Top Posters In This Topic

  • Edgtrimmer

    18

  • alanjt

    7

  • Jack_O'neill

    4

  • nestly

    4

Top Posters In This Topic

Posted Images

Thanks Allen. I tried out your LFC command. Unfortunately, the LFC.lsp command you wrote seems to have the same limitation as the QS.lsp command referenced above. It will not select a circle nested inside of a block. You are a coding machine though.

Then we'll cheat...

 

(defun c:LFC (/ *error* circle data temp ang)
 ;; Line From Circle
 ;; Alan J. Thompson, 08.15.11

 (vl-load-com)

 (defun *error* (msg)
   (and temp (entdel temp))
   (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
     (princ (strcat "\nError: " msg))
   )
 )

 (if (and (setq circle (nentselp "\nSelect circle: "))
          (eq (cdr (assoc 0 (setq data (entget (car circle))))) "CIRCLE")
          (cond ((eq (length circle) 2) (setq circle (car circle)))
                (T
                 (vla-transformby
                   (vlax-ename->vla-object (setq temp (entmakex data)))
                   (vlax-tmatrix (caddr circle))
                 )
                 (setq data (entget (setq circle temp)))
                )
          )
          (setq ang (getangle (trans (cdr (assoc 10 data)) 0 1) "\nSpecify angle for line: "))
     )
   (vl-cmdf
     "_.line"
     "_non"
     (trans (vlax-curve-getPointAtDist circle (* ang (cdr (assoc 40 data)))) 0 1)
     (strcat
       "<"
       (angtos (if (zerop (getvar 'WORLDUCS))
                 (- ang (angle '(0. 0. 0.) (trans (getvar 'UCSXDIR) 0 (trans '(0. 0. 1.) 1 0 T) T)))
                 ang
               )
               (getvar 'AUNITS)
               4
       )
     )
     PAUSE
   )
 )
 (*error* nil)
 (princ)
)

Link to comment
Share on other sites

Acuatlly, I use polar tracking almost all the time. It gives you the 45 degrees but not the exact starting point on the circle unless there is some trick I haven't come up with to get from the center of the circle to the point at 45 degrees on the circle. Thank you for all of your input. It is appreciated.

Link to comment
Share on other sites

Acuatlly, I use polar tracking almost all the time. It gives you the 45 degrees but not the exact starting point on the circle unless there is some trick I haven't come up with to get from the center of the circle to the point at 45 degrees on the circle. Thank you for all of your input. It is appreciated.

 

You'll need to have "Center" and "Intersection" OSnaps turned on. Basically, you're snapping the intersection of the tracking line and the circle (notice the "Intersection" osnap marker in the video http://screencast.com/t/IvxE30hKo

Link to comment
Share on other sites

The last post I saw with code was the LFC.lsp command you wrote. I did try that one. I works perfectly on a plain circle but doesn't recognize a circle that is nested inside of a block. That was the problem I had with the QS.lsp routine found on the Cadalyst website. Nice routine though.

Link to comment
Share on other sites

The last post I saw with code was the LFC.lsp command you wrote. I did try that one. I works perfectly on a plain circle but doesn't recognize a circle that is nested inside of a block. That was the problem I had with the QS.lsp routine found on the Cadalyst website. Nice routine though.

Try the second one I posted.

Link to comment
Share on other sites

Yes! I thought there should be something like that I could be doing. I just didn't think center and intersection would work but it obviously does. Thanks, I shall have to practice that technique. Question answered!

Link to comment
Share on other sites

I take it back. I tried the center-intersection technique and moving the cursor form the center along a 45 degree angle, the angle lost the 45 degrees once I intersected the circle. If you draw a line using your method, are you sure the line measures exactly 45 degrees from the circl center to its start point?

Link to comment
Share on other sites

I guess I didn't see the second posting of the LFC.lsp. I just pasted that code into Notepad and saved and ran it and yes it does work with a block containing a circle now. That's perfect. Thank you!

Link to comment
Share on other sites

I guess I didn't see the second posting of the LFC.lsp. I just pasted that code into Notepad and saved and ran it and yes it does work with a block containing a circle now. That's perfect. Thank you!

No worries. You're welcome. It was a bit of fun for a dull afternoon.

Link to comment
Share on other sites

Okay, I see where I was going wrong. I had additional running osnaps turned on. I had nearest on also, so that was why my cursor wasn't limited to the 45 degree intersection snap. Thank you very much for your help and for your patience. That is a good simple method to do what I want. I now have two nice ways to do what I want. Thanks to all!

Link to comment
Share on other sites

I had additional running osnaps turned on. I had nearest on also, so that was why my cursor wasn't limited to the 45 degree intersection snap.

Sorry about that, I never have NEAREST running and I didn't even consider that the NEAREST OSnap would have precedence over Osnap tracking.

Link to comment
Share on other sites

Thanks for the suggestion, but setting snapang to 45 doesn't let me snap to the circle block with a line 45 degrees out from the circle center though. I use polar tracking to easily draw lines at 45 degrees. Most of my lines, like most users are at increments of 90 degrees, so polar tracking is much easier way to draw 45 degrees lines than changing my snap angle back and forth from 0 to 45 degrees.

 

The 2 solutions I got, one from alanjt (nifty lisp command LFC.lsp) and the trick using running snap with polar tracking along with object snap tracking have solved the issue for me.

Link to comment
Share on other sites

Start Line command

Use the Center OSNAP or use the snap override (hold SHIFT + C) to start the line

With Dynamic input turned on - hit the TAB button to set the angle. After you enter 45 hit TAB again to specify the length or just place the line then trim where it intersects the circle.

then start a new line from the line + circle intersection and use the same dynamic input feature.

 

After learning this dynamic input technique, I have not used the polar function in over a year...

 

The attached picture is supposed to be an animated GIF but is aint very animated...

circleblock45.jpg

Link to comment
Share on other sites

Thank you for your input. Before the help I received in this forum, I had been doing something very similar to what you do. After starting the line command, I would right click my mouse to pop up object snaps and then hit the letter 'c' for center to pick the circle center. I have gotten used to polar tracking, so drawing the 45 degree angle from the circle center was no problem. Finally, I would trim the line from inside the circle like you do.

 

Using object snap tracking and polar tracking, I can just hover over the circle, then its center to light-up the center snap symbol, then move approx. 45 degrees toward circle until the intersection symbol lights up and pick the circle to start my line at 45 degrees from circle center at the intersection of the circle (can't have 'nearest' running osnap on). Takes a little practice but it eliminates any trimming after drawing the line.

Link to comment
Share on other sites

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...