Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

negitive values in lisp routine formulas

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
190 Views, 4 Replies

negitive values in lisp routine formulas

I have written a lisp routine to pull out the x and y of line segments and
set them to specific variables to be used in a formulas.

These are the variables....
x1 = x for the start point of a line1
y1 = y of the start point of a line1
x2 = x of the end point of a line1
y2 = y of the end point of a line1
x3 = x of the start point of line 2
y3 = y of the start point of line 2
x4 = x of the end point of line 2
y4 = y of the end point of line 2

(setq ua
(((x4-x3)(y1-y3))-((y4-y3)(x1-x3)))/(((y4-y3)(x2-x1))-((4-x3)(y2-y1))))

It errors at the calculation of (x1-x3) which returns a negative value The
program errors and gives me a "no function definition" error. Will lisp
calculate a formula with negative values? Is this the problem? How can you
get lisp to calculate a formula with positive and negative numbers in the
formula? Here is the formula:


This formula will give me a variable I need for another formula to find the
intersection point of these two lines.
intersectionx = x1 + ua(x2-x1)
intersectiony = y1 + ua(y2-y1)

End result is this. I am trying to find how the weight is distributed on
each end of a beam. Using a weight, and moment of inertia, I can calculate
the force, and input it in automatically at the support locations by
inputting text to the coordinated I already have for the supports. But I
can't get lisp to work with negative numbers in formulas.

Any assistance would be appreciated.

Thomas D. Wooton
Southern Systems Inc
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

It is the syntax that your are using this incorrect

(* 3 4) = 12
(- (* 3 4) (* 2 2)) = 3
(/ (- (* 3 4) (* 2 2)) (* 2 5)) = 0.3

We are a function 1st language.
-David


"Thomas D. Wooton" wrote in message
news:6ADF11CAFBED7443EE1F2155569B22C0@in.WebX.maYIadrTaRb...
> I have written a lisp routine to pull out the x and y of line segments and
> set them to specific variables to be used in a formulas.
>
> These are the variables....
> x1 = x for the start point of a line1
> y1 = y of the start point of a line1
> x2 = x of the end point of a line1
> y2 = y of the end point of a line1
> x3 = x of the start point of line 2
> y3 = y of the start point of line 2
> x4 = x of the end point of line 2
> y4 = y of the end point of line 2
>
> (setq ua
> (((x4-x3)(y1-y3))-((y4-y3)(x1-x3)))/(((y4-y3)(x2-x1))-((4-x3)(y2-y1))))
>
> It errors at the calculation of (x1-x3) which returns a negative value The
> program errors and gives me a "no function definition" error. Will lisp
> calculate a formula with negative values? Is this the problem? How can you
> get lisp to calculate a formula with positive and negative numbers in the
> formula? Here is the formula:
>
>
> This formula will give me a variable I need for another formula to find
the
> intersection point of these two lines.
> intersectionx = x1 + ua(x2-x1)
> intersectiony = y1 + ua(y2-y1)
>
> End result is this. I am trying to find how the weight is distributed on
> each end of a beam. Using a weight, and moment of inertia, I can calculate
> the force, and input it in automatically at the support locations by
> inputting text to the coordinated I already have for the supports. But I
> can't get lisp to work with negative numbers in formulas.
>
> Any assistance would be appreciated.
>
> Thomas D. Wooton
> Southern Systems Inc
>
>
>
Message 3 of 5
Anonymous
in reply to: Anonymous

Thank you, had a brain fart....all is working now...



"David Bethel" wrote in message
news:03FE88ACA03819273F85DD3F5530FA70@in.WebX.maYIadrTaRb...
> It is the syntax that your are using this incorrect
>
> (* 3 4) = 12
> (- (* 3 4) (* 2 2)) = 3
> (/ (- (* 3 4) (* 2 2)) (* 2 5)) = 0.3
>
> We are a function 1st language.
> -David
>
>
> "Thomas D. Wooton" wrote in message
> news:6ADF11CAFBED7443EE1F2155569B22C0@in.WebX.maYIadrTaRb...
> > I have written a lisp routine to pull out the x and y of line segments
and
> > set them to specific variables to be used in a formulas.
> >
> > These are the variables....
> > x1 = x for the start point of a line1
> > y1 = y of the start point of a line1
> > x2 = x of the end point of a line1
> > y2 = y of the end point of a line1
> > x3 = x of the start point of line 2
> > y3 = y of the start point of line 2
> > x4 = x of the end point of line 2
> > y4 = y of the end point of line 2
> >
> > (setq ua
> > (((x4-x3)(y1-y3))-((y4-y3)(x1-x3)))/(((y4-y3)(x2-x1))-((4-x3)(y2-y1))))
> >
> > It errors at the calculation of (x1-x3) which returns a negative value
The
> > program errors and gives me a "no function definition" error. Will lisp
> > calculate a formula with negative values? Is this the problem? How can
you
> > get lisp to calculate a formula with positive and negative numbers in
the
> > formula? Here is the formula:
> >
> >
> > This formula will give me a variable I need for another formula to find
> the
> > intersection point of these two lines.
> > intersectionx = x1 + ua(x2-x1)
> > intersectiony = y1 + ua(y2-y1)
> >
> > End result is this. I am trying to find how the weight is distributed on
> > each end of a beam. Using a weight, and moment of inertia, I can
calculate
> > the force, and input it in automatically at the support locations by
> > inputting text to the coordinated I already have for the supports. But I
> > can't get lisp to work with negative numbers in formulas.
> >
> > Any assistance would be appreciated.
> >
> > Thomas D. Wooton
> > Southern Systems Inc
> >
> >
> >
>
>
Message 4 of 5
Anonymous
in reply to: Anonymous

Well if I had only gotten the basic math

> > (- (* 3 4) (* 2 2)) = 3 <

12 - 8 = 4 Wow!!! It must be beer:30 on Friday -David



"Thomas D. Wooton" wrote in message
news:15B6C3BE5E96D1B9AA038896819EC079@in.WebX.maYIadrTaRb...
> Thank you, had a brain fart....all is working now...
>
>
>
> "David Bethel" wrote in message
> news:03FE88ACA03819273F85DD3F5530FA70@in.WebX.maYIadrTaRb...
> > It is the syntax that your are using this incorrect
> >
> > (* 3 4) = 12
> > (- (* 3 4) (* 2 2)) = 3
> > (/ (- (* 3 4) (* 2 2)) (* 2 5)) = 0.3
> >
> > We are a function 1st language.
> > -David
> >
> >
> > "Thomas D. Wooton" wrote in message
> > news:6ADF11CAFBED7443EE1F2155569B22C0@in.WebX.maYIadrTaRb...
> > > I have written a lisp routine to pull out the x and y of line segments
> and
> > > set them to specific variables to be used in a formulas.
> > >
> > > These are the variables....
> > > x1 = x for the start point of a line1
> > > y1 = y of the start point of a line1
> > > x2 = x of the end point of a line1
> > > y2 = y of the end point of a line1
> > > x3 = x of the start point of line 2
> > > y3 = y of the start point of line 2
> > > x4 = x of the end point of line 2
> > > y4 = y of the end point of line 2
> > >
> > > (setq ua
> > >
(((x4-x3)(y1-y3))-((y4-y3)(x1-x3)))/(((y4-y3)(x2-x1))-((4-x3)(y2-y1))))
> > >
> > > It errors at the calculation of (x1-x3) which returns a negative value
> The
> > > program errors and gives me a "no function definition" error. Will
lisp
> > > calculate a formula with negative values? Is this the problem? How can
> you
> > > get lisp to calculate a formula with positive and negative numbers in
> the
> > > formula? Here is the formula:
> > >
> > >
> > > This formula will give me a variable I need for another formula to
find
> > the
> > > intersection point of these two lines.
> > > intersectionx = x1 + ua(x2-x1)
> > > intersectiony = y1 + ua(y2-y1)
> > >
> > > End result is this. I am trying to find how the weight is distributed
on
> > > each end of a beam. Using a weight, and moment of inertia, I can
> calculate
> > > the force, and input it in automatically at the support locations by
> > > inputting text to the coordinated I already have for the supports. But
I
> > > can't get lisp to work with negative numbers in formulas.
> > >
> > > Any assistance would be appreciated.
> > >
> > > Thomas D. Wooton
> > > Southern Systems Inc
> > >
> > >
> > >
> >
> >
>
>
Message 5 of 5
Anonymous
in reply to: Anonymous

I don't believe it! TWICE !!!

> > > (- (* 3 4) (* 2 2)) = 3 <

12 - 4 = 8

I'm gone to my local tavern and calling it a day!!! -David

"David Bethel" wrote in message
news:4C0404349F9013E11F4A9F89B420BF88@in.WebX.maYIadrTaRb...
> Well if I had only gotten the basic math
>
>
> 12 - 8 = 4 Wow!!! It must be beer:30 on Friday -David
>
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost