PDA

View Full Version : Lisp to stack unstacked fractions?


stusic
2007-10-16, 09:51 PM
Hey All,

I've been getting such good help around here, I thought I'd ask for just a bit more... :)

We use a routine here that automatically divides a segment into even spaces in a modified dimension string. The problem is, howeve the routine does it, it doesn't stack the fractions. I've got to go into each dimension and add a space behind the fraction to make it stack, then I've got to backspace to remove the extra space. I haven't been able to figure out how to do a "Find and Replace" to correct these dimensions, since I put "Find: 1/2", Replace with: 1/2""...

See how I'm a bit confused as to how to do this? I'm not literate at LISP at all (although I am trying!), but I have done some of the legwork (see below), I just don't know how to define the function...

Any ideas?


(defun c:Replace ()
(FindReplaceAll "1/16"" "1#16"")
(FindReplaceAll "1/8"" "1#8"")
(FindReplaceAll "3/16"" "3#16"")
(FindReplaceAll "1/4"" "1#4"")
(FindReplaceAll "5/16"" "5#16"")
(FindReplaceAll "3/8"" "3#8"")
(FindReplaceAll "7/16"" "7#16"")
(FindReplaceAll "1/2"" "1#2"")
(FindReplaceAll "9/16"" "9#16"")
(FindReplaceAll "5/8"" "5#8"")
(FindReplaceAll "11/16"" "11#16"")
(FindReplaceAll "3/4"" "3#4"")
(FindReplaceAll "13/16"" "13#16"")
(FindReplaceAll "7/8"" "7#8"")
(FindReplaceAll "15/16"" "15#16"")

(princ)
);defun


Any help would be greatly appreciated!

d_m_hopper
2007-10-17, 06:48 AM
have you tried setting the dimfrac variable?

Type: Integer
Saved in: Drawing
Initial value: 0


Sets the fraction format when DIMLUNIT is set to 4 (Architectural) or 5 (Fractional).

0 Horizontal

1 Diagonal

2 Not stacked (for example, 1/2)

or do I not understand?

you can run a dim update after your routine is finished...

Dim: frac
Enter new value for dimension variable <1>: 0

Dim: up

Select objects: Specify opposite corner: 3 found

stusic
2007-10-17, 03:00 PM
Yeah, but see that's part of the problem: all my variables are as they should be; DIMFRAC is 1, and DIMUPDATE does nothing...

I'm not sure what the routine is doing to mess up the dimension string... If I run a regular dimension, it comes out fine. I think it has to do with it not being a real dimension, but a dimension string with a text override applied. Is there a way to "hard-format" a piece of text to make it stack? Then I could either modify the code in our routine to force stacking or get a LISP made up to auto-stack them.

Mike_R
2007-10-17, 11:35 PM
I'm not entirely sure of the problem, but try setting your texteval variable to 1 (on).

jwanstaett
2007-10-19, 03:01 PM
Yeah, but see that's part of the problem: all my variables are as they should be; DIMFRAC is 1, and DIMUPDATE does nothing...

I'm not sure what the routine is doing to mess up the dimension string... If I run a regular dimension, it comes out fine. I think it has to do with it not being a real dimension, but a dimension string with a text override applied. Is there a way to "hard-format" a piece of text to make it stack? Then I could either modify the code in our routine to force stacking or get a LISP made up to auto-stack them.

to stack fraction in text overrides

exp: for 1/2

{\H0.75x;\S1/2;} Horizontal stack
{\H0.75x;\S1#2;} Dlagonal stack

the 0.75 is the the scale of the stack fraction