Author Topic: Stacked Fractions - NOT MTEXT  (Read 2604 times)

0 Members and 1 Guest are viewing this topic.

David Bethel

  • Swamp Rat
  • Posts: 656
Stacked Fractions - NOT MTEXT
« on: October 23, 2014, 06:12:16 AM »
Morning,

I normally do not use archictural units, but have a instance where it is required.

I'm making a stacked fraction ( MTEXT Not allowed ) and wonder about the proper format

Q: should the numerator and denomenator text be the same height and the whole number?

Q: do you think X Factor Scaling would be appropiate?

Q: I'm leaning to  nnn/1000 for decimals that are not (expt 2 nn) based.   ?

Any suggestions ?  ( not pretty code at all )

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test (/ r m)
  2.  
  3.   (initget 7)
  4.   (setq r (getdist "\nReal To Convert To Stack Fraction:   "))
  5.  
  6.   (initget 1)
  7.   (setq m (getpoint "\nMidPoint:   "))
  8.  
  9.   (nw_stack r m)
  10.  
  11.   (prin1))
  12.  
  13.  
  14. ;;;ARG -> r REAL p MIDPOINT
  15. (defun nw_stack (r p / d e i q g u s tz ht)
  16.   (setq tz (getvar "TEXTSIZE")
  17.         ht (* tz 0.5)
  18.          d (rem r 1)
  19.          e 0)
  20.   (repeat 6
  21.       (setq i (expt 2 e)
  22.             g (/ 1.0 i))
  23.       (if (and (not s)
  24.                (zerop (rem d g)))
  25.           (setq q (/ 1.0 i)
  26.                 u (/ d q)
  27.                 s (list (rtos u 2 0) (rtos (/ 1.0 g) 2 0))))
  28.       (setq e (1+ e)))
  29.  
  30.   (or s (setq s (list (rtos (* d 1e+3) 2 0) "1000")))
  31.  
  32.   (entmake (list (cons 0 "TEXT")(cons 62 9)
  33.                  (cons 1 (itoa (fix r)))
  34.                  (cons 7 (getvar "TEXTSTYLE"))
  35.                  (cons 10 (mapcar '+ p (list (- ht) 0 0)))
  36.                  (cons 11 (mapcar '+ p (list (- ht) 0 0)))
  37.                  (cons 40 tz)(cons 72 2)(cons 73 2)))
  38.  
  39.   (entmake (list (cons 0 "LINE")(cons 62 9)
  40.                  (cons 10 (mapcar '+ p (list (* ht 0.5) 0 0)))
  41.                  (cons 11 (mapcar '+ p (list (* ht 3.5) 0 0)))))
  42.  
  43.   (entmake (list (cons 0 "TEXT")(cons 62 9)
  44.                  (cons 1 (car s))
  45.                  (cons 7 (getvar "TEXTSTYLE"))
  46.                  (cons 10 (mapcar '+ p (list tz (* tz 0.85) 0)))
  47.                  (cons 11 (mapcar '+ p (list tz (* tz 0.85) 0)))
  48.                  (cons 40 tz)(cons 72 4)))
  49.  
  50.   (entmake (list (cons 0 "TEXT")(cons 62 9)
  51.                  (cons 1 (cadr s))
  52.                  (cons 7 (getvar "TEXTSTYLE"))
  53.                  (cons 10 (mapcar '+ p (list tz (- (* tz 0.85)) 0)))
  54.                  (cons 11 (mapcar '+ p (list tz (- (* tz 0.85)) 0)))
  55.                  (cons 40 tz)(cons 72 4)))
  56. r)
  57.  


Thanks!  -David
R12 Dos - A2K

ChrisCarlson

  • Guest
Re: Stacked Fractions - NOT MTEXT
« Reply #1 on: October 23, 2014, 08:04:29 AM »
Why is mtext not allowed?

1) typically the fraction total height is the same as the whole number, so the numerator / denominator should be a little under half the height.
 
2)

3) I'm not sure what point if any xxx/1000 would do, I've never seen mechanical drawings which go to thousandths of an inch with fractions? I'm sure it varies from project to project but the smallest we go is 1/64" as a fraction, smaller numbers are decimals.

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Stacked Fractions - NOT MTEXT
« Reply #2 on: October 23, 2014, 09:03:22 AM »

MText is not available in the platform this is being used on

Without rounding, what would be done with say 15.003 ?

       3
15 -----
    1000



Thanks!  -David
R12 Dos - A2K

danallen

  • Guest
Re: Stacked Fractions - NOT MTEXT
« Reply #3 on: October 23, 2014, 12:40:28 PM »
       3
15 -----
    1000

That is not architectural, the lowest I've ever dimensioned is 1/32" of an inch, and really only should be decimal for anything below 1/16" as that would typically be machined, not cut by someone with an foot-inch tape measure.

hmspe

  • Bull Frog
  • Posts: 362
Re: Stacked Fractions - NOT MTEXT
« Reply #4 on: October 23, 2014, 01:38:06 PM »
At the risk of stating the obvious, for the text size and configuration I'd suggest using the mtext editor to create a mixed number with a stacked fraction, explode the mtext, then (entget (car (entsel))) each component.  I'd actually do two cases, one with a single digit denominator and one with a two digit denominator.
"Science is the belief in the ignorance of experts." - Richard Feynman

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Stacked Fractions - NOT MTEXT
« Reply #5 on: October 23, 2014, 02:22:13 PM »
I work mostly in Release 12 and don't have access to any mtext features.  The end result of this is an automated dimension of a parametric model.  To ( entmake ) dimensions is a royal pain, so I find it easier just to make a quasi dimensions.  They look close and are accurate.  These are 1 time shots.  If some thing is changed, the entire process is done over, no editing at all.

-David

R12 Dos - A2K

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: Stacked Fractions - NOT MTEXT
« Reply #6 on: October 24, 2014, 09:14:45 AM »
Code suggestion:
You can grab the code I ported over from the SICP class (Scheme language) as a base; it's not much but the code is a framework for using OOP like methods in procedural languages so it wasn't meant to be much in the first place. You can find it in my LiFP tutorial (if you don't use LiFP, I'm afraid you'll have to cut and paste and manage the procedures the old fashioned way but at least it's something).

Other then that, neat concept.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Stacked Fractions - NOT MTEXT
« Reply #7 on: October 24, 2014, 10:32:46 AM »
Code suggestion:


Other then that, neat concept.

Thanks !  I'll dig into SICP stuff.  It looks lke it is a bit over my simple minded head.  who knows,  maybe an old dog can learn a new trick !  -David
R12 Dos - A2K

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: Stacked Fractions - NOT MTEXT
« Reply #8 on: October 24, 2014, 01:50:29 PM »
Thanks !  I'll dig into SICP stuff.  It looks lke it is a bit over my simple minded head.  who knows,  maybe an old dog can learn a new trick !  -David

heh! ...SICP is a bit over my head as well (no lie, that class was TOUGH!!!).

The code is simple enough to follow (even I can follow it after all these years of not looking at lisp) so you should be able to expand on it pretty quick. As far as I can tell you can put your entmake stuff in the "print-rat" function and just start coding up the conditionals you want to account for.

At any rate, hope it helps.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org