ERRO : syntax error

ERRO : syntax error

rolisonfelipe
Collaborator Collaborator
814 Views
4 Replies
Message 1 of 5

ERRO : syntax error

rolisonfelipe
Collaborator
Collaborator

(defun C:ACO ()
(vl-load-com)
(setq SS1 (ssget '((0 . "LWPOLYLINE,MPOLYGON")))
NUM 0
ACR 0
)
(if SS1
(progn
(repeat (sslength SS1)
(setq ACR (+ ACR
(vla-get-area (vlax-ename->vla-object (ssname SS1 NUM)))
)
NUM (1+ NUM)
)
)
(GETUNITS)
(setq NUM (rtos NUM 2 0)
UNI1 (rtos (/ ACR FCA1) 2 3 "METRO(S)")
UNI2 (rtos (/ ACR FCA2) 2 3 "HACTARE(S)")
UNI3 (rtos (/ ACR FCA3) 2 3 "ALQUERE(S)")
)
(princ (strcat "\n" ACR " M2"))
(alert (strcat "Units = " UNT1 "\n\n" NUM " Objeto (s) selecionado(s)\n" UNI1 " M2\n " UNI2 " HA \n " UNI3 " HE" ))
)
)
(princ)
)

(defun GETUNITS ()
(IF (COND
((= UNT1 "1") (setq FCA1 1 ))
((= UNT2 "2") (setq FCA2 10000 ))
((= UNT3 "3") (setq FCA3 48400 ))
)
)
)
(princ "\nType ACO to begin.")
(princ)

0 Likes
815 Views
4 Replies
Replies (4)
Message 2 of 5

dlanorh
Advisor
Advisor

 

(defun GETUNITS ()
(IF (COND
((= UNT1 "1") (setq FCA1 1 ))
((= UNT2 "2") (setq FCA2 10000 ))
((= UNT3 "3") (setq FCA3 48400 ))
)
)
)

 

 

This doesn't work. You have a (cond) inside an (if) which is not needed. The condition has three different variables (UNT1, UNT2 & UNT3) instead of 1 and  none of them are ever given a value (unless it comes from outside)

 

 

(setq NUM (rtos NUM 2 0)
UNI1 (rtos (/ ACR FCA1) 2 3 "METRO(S)")
UNI2 (rtos (/ ACR FCA2) 2 3 "HACTARE(S)")
UNI3 (rtos (/ ACR FCA3) 2 3 "ALQUERE(S)")
)

 

 

This is the syntax error. The (rtos) statements. I think you want to

(setq UNI1 (strcat (rtos (/ ACR FCA1) 2 3) "METRO(S)")

 

but this will only work if you sort out (defun GETUNITS)

 

I am not one of the robots you're looking for

Message 3 of 5

Kent1Cooper
Consultant
Consultant

[never mind]

Kent Cooper, AIA
0 Likes
Message 4 of 5

rolisonfelipe
Collaborator
Collaborator

I SIMPLIFY TO THE MAXIMUM, REMOVED ALL THE ARGUMENTS. AND ERROR STILL APPEARS
: too many arguments

WHAT TO DO?

HOW TO DO?

 

THANK YOU TO ALL, AND A HAPPY NEW YEAR

 

(defun c:ACO ()
(vl-load-com)
(setvar "cmdecho" 0)
(setq SS1 (ssget '((-4 . "<OR")
(0 . "POLYLINE")
(0 . "LWPOLYLINE")
(0 . "CIRCLE")
(0 . "ELLIPSE")
(0 . "SPLINE")
(0 . "REGION")
(-4 . "OR>")
)
)
COUNTER 0
AREA 0
)
(setq REPETIR (sslength SS1))
(repeat REPETIR
(setq VLAENT (vlax-ename->vla-object (ssname SS1 COUNTER)))
(setq AREA (+ AREA (vla-get-area VLAENT)))
(setq COUNTER (1+ COUNTER))
)
(setq NUMERAR (strcat "N TOTAL: " (rtos COUNTER 2 0)))
(setq METROS (strcat (rtos (/ AREA 1) 2 2 "METRO(S) ")))
(setq HECTARES (strcat (rtos (/ AREA 10000) 2 2 "HECTARE(S)")))
(setq ALQUERES (strcat (rtos (/ AREA 10000) 2 2 "ALQUERES(S)")))
(princ NUMERAR METROS HECTARES ALQUERES )
(princ "\nRoteiro de uma medição jurídica,1966Viçosa/MG")
(alert (strcat NUMERAR ">> " UNT "\n\n" METROS "\n >" METROS "\n >" HECTARES "\n >" ALQUERES "\n\n Roteiro de uma medição jurídica,1966Viçosa/MG" ))
(princ)
)

0 Likes
Message 5 of 5

marko_ribar
Advisor
Advisor

(setq METROS (strcat (rtos (/ AREA 1) 2 2 "METRO(S) ")))
(setq HECTARES (strcat (rtos (/ AREA 10000) 2 2 "HECTARE(S)")))
(setq ALQUERES (strcat (rtos (/ AREA 10000) 2 2 "ALQUERES(S)")))

BAD...

(setq METROS (strcat (rtos (/ AREA 1) 2 2) "METRO(S) "))
(setq HECTARES (strcat (rtos (/ AREA 10000) 2 2) "HECTARE(S)"))
(setq ALQUERES (strcat (rtos (/ AREA 10000) 2 2) "ALQUERES(S)"))

TRY ABOVE...

Marko Ribar, d.i.a. (graduated engineer of architecture)