Jump to content

what's wrong in my code ((syntax error)).any ideas?


Recommended Posts

Posted

the scale is nothing is only a parameter to change the function

a) if the scale 1: 1000 we have this T = [((sqrtA) + 1)^ 2) - A] * [ L/( 4*(sqrtA)]

b) if the scale 1: 5000 we have this T = [((sqrtA) + 4)^ 2) - A] * [ L/( 4*(sqrtA)]

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • BlackBox

    10

  • marko_ribar

    2

  • ReMark

    1

  • lyky

    1

Top Posters In This Topic

Posted

for scale 1:1000 we have T1 and for scale 1:5000 we have T2 . T2 > T1 we have bigger tolerαnse.

Posted

i dont want to see the BOTH tolerances but i canot aderstand how to do it . I now a few things about lisp

Posted

the scale is nothing is only a parameter to change the function

a) if the scale 1: 1000 we have this T = [((sqrtA) + 1)^ 2) - A] * [ L/( 4*(sqrtA)]

b) if the scale 1: 5000 we have this T = [((sqrtA) + 4)^ 2) - A] * [ L/( 4*(sqrtA)]

 

That was not clear (to me) initially, but I understand now... Try this:

 

(defun c:ktim (/ s a i l e v1 v2 v3)
 (if (setq s
            (ssget
              '((0 . "CIRCLE,ELLIPSE,*POLYLINE,SPLINE")
                (-4 . "<NOT")
                (-4 . "<AND")
                (0 . "POLYLINE")
                (-4 . "&")
                (70 . 80)
                (-4 . "AND>")
                (-4 . "NOT>")
               )
            )
     )
   (progn
     (setq a 0.0)
     (repeat (setq i (sslength s))
       (setq a (+ a (vlax-curve-getarea (ssname s (setq i (1- i))))))
     )

     (setq l 0.0)
     (repeat (setq i (sslength s))
       (setq e (ssname s (setq i (1- i)))
             l (+ l
                  (vlax-curve-getdistatparam e (vlax-curve-getendparam e))
               )
       )
     )
     (princ "\nTotal Length: ")
     (princ (rtos l 2 2))

     (princ "\nTotal Area: ")
     (princ (rtos a 2 2))

     (setq v1 (- (* (setq v2 (+ 1 (setq v3 (sqrt a)))) 2) a))
     (setq v2 (- (* v2 4) a))
     (setq v3 (/ l (* v3 4)))

     ;; if the scale 1: 1000 we have this
     ;; T = [((sqrtA) + 1)^ 2) - A] * [ L/( 4*(sqrtA)]
     (princ "\n Tolerance (1:1000): ")
     (princ (rtos (* v1 v3) 2 2))

     ;; if the scale 1: 5000 we have this
     ;; T = [((sqrtA) + 1)^ 4) - A] * [ L/( 4*(sqrtA)]
     (princ "\n Tolerance (1:5000): ")
     (princ (rtos (* v2 v3) 2 2))

     (princ "\n 10 % Area : ")
     (princ (rtos (* a 0.1) 2 2))
   )
 )
 (princ)
)

Posted
i dont want to see the BOTH tolerances

 

According to your example here, you DO:

Select objects:

 

Total Length: 66.18

Total Area: 266.50

Tolerance 1:1000: 8.526

Tolerance 1:5000: 37.144

10 % Area : 26.65

 

Command:

 

 

 

... but i canot aderstand how to do it . I now a few things about lisp

 

Slow down... I'm having trouble understanding what you're after... Please post one, single, clearly written explanation (with examples?) so this doesn't become unnecessarily complicated.

 

We're trying to help.

Posted (edited)
look the correct function is 
T = [Q - A] * [ L/B]
Q =((sqrtA) + 2*U)^ 2)  
if scale is 1:1000 U=0.5 
if scale is 1:1000 U=2
B = 4*(sqrt A) 
thats whay  i write 
a) if the scale 1: 1000 we have this T = [((sqrtA) + 1)^ 2) - A] * [ L/( 4*(sqrtA)]
b) if the scale 1: 5000 we have this T = [((sqrtA) + 4)^ 2) - A] * [ L/( 4*(sqrtA)]

Edited by prodromosm
Posted

A= the area of a selected close polyline ,polygon ,circle anything (square meters)

L= i the perimetr of this ,polygon ,circle anything (meters)

Posted

Total Length: 66.18

Total Area: 266.50

Tolerance (1:1000): -234.98

Tolerance (1:5000): -199.86

10 % Area : 26.65

--------------------------------------------------------

something is wrong here because

for A=266.50sqm and L=66.18 m calculate a) T=8.526 and the correct is T = 34.10

b) T=37.144 and the correct is T = 148.58

Posted
look the correct function is

T = [Q - A] * [ L/B]

Q =((sqrtA) + 2*U)^ 2)

if scale is 1:1000 U=0.5

if scale is 1:1000 U=2

B = 4*(sqrt A)

thats whay i write

a) if the scale 1: 1000 we have this T = [((sqrtA) + 1)^ 2) - A] * [ L/( 4*(sqrtA)]

b) if the scale 1: 5000 we have this T = [((sqrtA) + 4)^ 2) - A] * [ L/( 4*(sqrtA)]

 

You seem to have some inconsistencies... I cannot help you without the correct formulae.

Posted

Ok my friendrs i fix it many thanks

for the history re correct facrion is

 

(princ "\n for scale 1:1000: ")
     (princ (rtos (/ (* (- (expt (+ (sqrt a) 1) 2) a) l 0.25 ) (sqrt a))  2 2 )  
     )
     (princ "\n for scale 1:5000: ")
     (princ (rtos (/ (* (- (expt (+ (sqrt a) 4) 2) a) l 0.25 ) (sqrt a))  2 2 )  
     )

 

Many thanks to marko_ribar ,BlackBox ,lyky and SLW210

 

Cheers, :beer: men nothing better than a cold beer ............... :notworthy:

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