Author Topic: Line Distance  (Read 1458 times)

0 Members and 1 Guest are viewing this topic.

cadman6735

  • Guest
Line Distance
« on: February 09, 2017, 10:41:10 AM »
Good day,

I am looking for a lisp routine that will allow me to draw a PLine a specified inputted distance with as many vertices click points within that distance so I can change direction then stop once distance, length of PLine has been reached.

I usually like to try to figure this out on my own first but I have so very little time to experiment that I thought I would just ask. 

thanks for any help.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Line Distance
« Reply #1 on: February 09, 2017, 12:28:27 PM »

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Line Distance
« Reply #2 on: February 09, 2017, 01:10:52 PM »
Lee, like I pointed in my reply, your LWPOLYLINE don't have ARCs... Instead of this, I would suggest OP to firstly draw curve entity and then trim it to desired length... Look this reply :
https://www.theswamp.org/index.php?topic=51622.msg567069#msg567069

HTH., M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

cadman6735

  • Guest
Re: Line Distance
« Reply #3 on: February 09, 2017, 02:39:32 PM »
Lee,

thank you very much, exactly what I was asking for.  After seeing your code I don't think I would have ever accomplished this task.  I got a kick out of the credits to ElpanovEvgniy for saving you some typing.  Just out of curiosity, the numeric in the snippit code below, what is that, where did those number come from, they seem so randomly-not so random?


Ribarm, not what I was looking for but handy too.  Thank you


Code: [Select]
[/;;-----------------------=={ GrText }==-----------------------;;
;;                                                            ;;
;;  Returns a grvecs pixel vector list relative to the origin ;;
;;  encoding the supplied string.                             ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  With thanks to ElpanovEvgeniy for the method of vector    ;;
;;  encoding to save me a lot of typing.                      ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  str - String to be expressed in vector list format.       ;;
;;------------------------------------------------------------;;
;;  Returns:  GrVecs Pixel Vector List relative to the Origin ;;
;;------------------------------------------------------------;;
;;  Version 1.1    -    26-03-2011                            ;;
;;------------------------------------------------------------;;

(defun LM:grtext ( str / asc lst vec xco yco )
    (setq vec
       '(
            (033 045 045 065 135)
            (034 104 134 107 137)
            (035 043 063 046 066 084 094 087 097 115 135 118 138 072 078 103 109)
            (036 025 035 052 052 043 047 058 078 083 087 092 112 123 127 118 118 135 135)
            (037 052 052 063 063 074 074 085 085 096 096 107 107 118 118 129 129 047 048 067 068 056 056 059 059 113 114 133 134 122 122 125 125)
            (038 043 046 049 049 052 072 057 058 067 068 076 076 079 079 083 083 085 085 094 094 103 123 134 136 127 127)
            (039 105 135)
            (040 017 017 026 036 045 105 116 126 137 137)
            (041 014 014 025 035 046 106 115 125 134 134)
            (042 073 074 076 077 084 086 092 098 104 106 113 114 116 117)
            (043 055 115 082 084 086 088)
            (044 034 035 045 046 055 057)
            (045 083 088)
            (046 045 046 055 056)
            (047 052 052 063 063 074 074 085 085 096 096 107 107 118 118 129 129)
            (048 044 047 134 137 053 123 058 128)
            (049 044 048 124 125 056 136)
            (050 043 048 053 053 064 064 075 075 086 086 097 097 108 128 134 137 123 123)
            (051 053 053 044 047 058 088 095 097 108 128 134 137 123 123)
            (052 046 048 057 137 078 078 073 076 083 083 094 094 105 115 126 126)
            (053 053 053 044 047 058 088 094 097 093 133 134 138)
            (054 044 047 058 088 095 097 084 084 053 113 124 124 135 137)
            (055 044 054 065 075 086 096 107 117 128 138 133 137 123 123)code]

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Line Distance
« Reply #4 on: February 09, 2017, 05:58:45 PM »
thank you very much, exactly what I was asking for.  After seeing your code I don't think I would have ever accomplished this task.

You're most welcome - As a consequence of the visual effects, the code is obviously far more elaborate than is strictly required, and so may be viewed more as a concept program than a serious application, but I'm pleased that you find it useful.

I got a kick out of the credits to ElpanovEvgniy for saving you some typing.

:-)

Just out of curiosity, the numeric in the snippit code below, what is that, where did those number come from, they seem so randomly-not so random?

The code which follows list of integers gives the game away somewhat: the first integer is the ASCII character code of the character being encoded, and each of the remaining integers encodes two items of information using a 'base-10' encoding if you will (since the characters of the fixed-pitch font represented by the program are at most 9 pixels wide). Therefore, the x-coordinate of the vector endpoint is given by the remainder after dividing the integer by 10 (i.e. the ones), and the y-coordinate of the vector is the multiple obtained from this division (i.e. the tens).