Jump to content

Recommended Posts

Posted

I was given a drawing that represents underground fiber communications for a very large area. I am just using the drawing as reference and had designated a linetype for these as -UC- the issue is the drawing has lines going in all sorts of different directions so some are lines that run parallel to one another have different direction text.

I was wondering if there was a routine out there (that I can't find) that will scan all lines to verify that the start point of the line is closer to origin than the end line and rotate 180deg otherwise so all the text will read left to right?

Posted

Totally untested:

 

[b][color=BLACK]([/color][/b]defun c:linedir [b][color=FUCHSIA]([/color][/b] / ss i en ed p10 p11 d11 d10[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not ss[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect Lines Sort:   "[/color][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"LINE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq i [b][color=NAVY]([/color][/b]sslength ss[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]minusp [b][color=GREEN]([/color][/b]setq i [b][color=BLUE]([/color][/b]1- i[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq en [b][color=MAROON]([/color][/b]ssname ss i[b][color=MAROON])[/color][/b]
              ed [b][color=MAROON]([/color][/b]entget en[b][color=MAROON])[/color][/b]
              p10 [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 10 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              d10 [b][color=MAROON]([/color][/b]distance '[b][color=GREEN]([/color][/b]0 0 0[b][color=GREEN])[/color][/b] p10[b][color=MAROON])[/color][/b]
              p11 [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 11 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              d11 [b][color=MAROON]([/color][/b]distance '[b][color=GREEN]([/color][/b]0 0 0[b][color=GREEN])[/color][/b] p11[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]> d11 d10[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]subst [b][color=BLUE]([/color][/b]cons 10 p11[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]assoc 10 ed[b][color=BLUE])[/color][/b] ed[b][color=GREEN])[/color][/b]
                   ed [b][color=GREEN]([/color][/b]subst [b][color=BLUE]([/color][/b]cons 11 p10[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]assoc 11 ed[b][color=BLUE])[/color][/b] ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]entmod ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]redraw[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

-David

Posted

Sorry doesn't seem to do anything to any line I select.

Posted

Let me correct myself it seems to make the lines go from right to left (toward origin) than left to right (away from origin).

Posted

I have changed the greater than sign and all seems to be working appropriatly. I will let you know if it works on the whole drawing.

Posted

Works great. All the lines seem to be in the appropriate direction. Thanks again.

Posted

Good catch on the greater than sign. Good luck

 

There are chances that the distances will be equal. So it would be a moot point. -David

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