Jump to content

Connecting lines or poly-lines at center of circle


wal_dab

Recommended Posts

Try the following:

([color=BLUE]defun[/color] c:cc ( [color=BLUE]/[/color] cn1 cn2 en1 en2 ent gr1 gr2 rd1 rd2 )
   ([color=BLUE]while[/color]
       ([color=BLUE]progn[/color] ([color=BLUE]setvar[/color] 'errno 0) ([color=BLUE]setq[/color] ent ([color=BLUE]car[/color] ([color=BLUE]entsel[/color] [color=MAROON]"\nSelect circle: "[/color])))
           ([color=BLUE]cond[/color]
               (   ([color=BLUE]=[/color] 7 ([color=BLUE]getvar[/color] 'errno))
                   ([color=BLUE]princ[/color] [color=MAROON]"\nMissed, try again."[/color])
               )
               (   ([color=BLUE]null[/color] ent) [color=BLUE]nil[/color])
               (   ([color=BLUE]/=[/color] [color=MAROON]"CIRCLE"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 ([color=BLUE]setq[/color] en1 ([color=BLUE]entget[/color] ent)))))
                   ([color=BLUE]princ[/color] [color=MAROON]"\nSelected object is not a circle."[/color])
               )
               (   ([color=BLUE]setq[/color] cn1 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 en1))
                         rd1 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 40 en1))
                   )
                   ([color=BLUE]while[/color]
                       ([color=BLUE]progn[/color]
                           ([color=BLUE]setq[/color] gr1 ([color=BLUE]grread[/color] [color=BLUE]t[/color] 13 2)
                                 gr2 ([color=BLUE]cadr[/color] gr1)
                                 gr1 ([color=BLUE]car[/color]  gr1)
                           )
                           ([color=BLUE]cond[/color]
                               (   ([color=BLUE]=[/color] 5 gr1)
                                   ([color=BLUE]redraw[/color])
                                   ([color=BLUE]grdraw[/color] ([color=BLUE]polar[/color] cn1 ([color=BLUE]angle[/color] cn1 gr2) rd1) gr2 1 1)
                                   [color=BLUE]t[/color]
                               )
                               (   ([color=BLUE]=[/color] 3 gr1)
                                   ([color=BLUE]cond[/color]
                                       (   ([color=BLUE]not[/color] ([color=BLUE]setq[/color] ent ([color=BLUE]car[/color] ([color=BLUE]nentselp[/color] gr2))))
                                           ([color=BLUE]princ[/color] [color=MAROON]"\nMissed, try again."[/color])
                                       )
                                       (   ([color=BLUE]/=[/color] [color=MAROON]"CIRCLE"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 ([color=BLUE]setq[/color] en2 ([color=BLUE]entget[/color] ent)))))
                                           ([color=BLUE]princ[/color] [color=MAROON]"\nSelected object is not a circle."[/color])
                                       )
                                       (   ([color=BLUE]setq[/color] cn2 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 en2))
                                                 rd2 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 40 en2))
                                           )
                                           ([color=BLUE]entmakex[/color]
                                               ([color=BLUE]list[/color]
                                                  '(0 . [color=MAROON]"LINE"[/color])
                                                   ([color=BLUE]cons[/color] 10 ([color=BLUE]polar[/color] cn1 ([color=BLUE]angle[/color] cn1 cn2) rd1))
                                                   ([color=BLUE]cons[/color] 11 ([color=BLUE]polar[/color] cn2 ([color=BLUE]angle[/color] cn2 cn1) rd2))
                                               )
                                           )
                                           ([color=BLUE]redraw[/color])
                                           ([color=BLUE]setq[/color] cn1 cn2 rd1 rd2)
                                       )
                                   )
                               )
                           )
                       )
                   )
               )
           )
       )
   )
   ([color=BLUE]redraw[/color]) ([color=BLUE]princ[/color])
)

Link to comment
Share on other sites

Lee,

 

 

This is awesome. Thank you.

 

 

Could it be modified to connect from the center of a circle to the center of a line, or segment of a line?

Link to comment
Share on other sites

This is awesome. Thank you.

 

You're welcome!

 

Could it be modified to connect from the center of a circle to the center of a line, or segment of a line?

 

What you do mean by connecting to a 'segment of a line'? - Could you post an image?

Link to comment
Share on other sites

Lee,

 

 

I meant the center of a segment of a polyline. Say if you had a polyline with three line, connecting to the center of one of the segments.

 

 

I'm not sure if that's the official naming convention. Sorry for the confusion.

Link to comment
Share on other sites

  • 3 weeks later...

Instead of breaking all those lines at the circle (lines no longer match displayed length), just use a block with a wipeout to cover the intersecting lines.

Link to comment
Share on other sites

AlanJt nice idea much better as lines are still true length.

:) Thank you.

I'm just not a fan of altering data for the sake of presentation.

I'd rather come up with an alternate solution.

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