marko_ribar 发表于 2022-7-6 07:03:13

OP changed formulas at 05:14 pm... But I think that now can finish the code right...
 
Cheers, Black Box...

BlackBox 发表于 2022-7-6 07:05:04

 
Cheers, Marko

prodromosm 发表于 2022-7-6 07:08:42

is not working now

prodromosm 发表于 2022-7-6 07:13:28

Command: (LOAD "C:/Users/Prodromos/Desktop/ktimtel.lsp") C:KTIM
Command: ktim
** Scale must be "1:1000" or "1:5000"
Command:
 
!!!!!!!!!!!!!!!!!!!!!!!!!!

prodromosm 发表于 2022-7-6 07:15:06

but i still need help because i confused

prodromosm 发表于 2022-7-6 07:20:23

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)]
 
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
here is the code
--------------------------------

(defun c:ktim (/ a l i s) (if (setq s            (ssget            '((0 . "CIRCLE,ELLIPSE,*POLYLINE,SPLINE")                (-4 . "")               )            )   )   (progn   (setq a 0.0)   (repeat (setq i (sslength s))       (setq a (+ a (vlax-curve-getarea (ssname s (setq i (1- i))))))   );;;      (progn   (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))               )       )   )(textscr)   (princ "\nTotal Length: ")   (princ (rtos l 2 2));;;      )   (princ "\nTotal Area: ")   (princ (rtos a 2 2));;;    )   (princ "\n Tolerance 1:1000: ")   (princ       (rtos (/ (* (- (* (+ (sqrt a) 1) (+ (sqrt a) 1)) a) l)                (* (sqrt a) 4)                2                2             )       )   )(princ "\n Tolerance 1:5000: ")   (princ       (rtos (/ (* (- (* (+ (sqrt a) 4) (+ (sqrt a) 4)) a) l)                (* (sqrt a) 4)                2                2             )       )   )   (princ "\n 10 % Area : ")   (princ (rtos (* a 0.1) 2 2))   ) ) (princ))(vl-load-com)(princ)

BlackBox 发表于 2022-7-6 07:22:43

 
How are you determining your scale (1:1000 vs. 1:5000)?
 
As I mentioned at the bottom of this post, I could only speculate that you were using Annotative Scale... Perhaps you're using DimScale?
 
In any event, without knowing which scale to check for the two specific values you requested, there's no way to ensure that the calculation is accurate.
 
more information is needed, so that we're not confused.

prodromosm 发表于 2022-7-6 07:26:07

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:

BlackBox 发表于 2022-7-6 07:29:12

Please fix your post(s) to use

BlackBox 发表于 2022-7-6 07:30:48

Ohhhhh! You want to see BOTH tolerances.
页: 1 [2]
查看完整版本: what's wrong in my code (