ERRO EDIT

ERRO EDIT

rolisonfelipe
Collaborator Collaborator
4,407 Views
21 Replies
Message 1 of 22

ERRO EDIT

rolisonfelipe
Collaborator
Collaborator

ERRO


Command:
Command:
Command:
Requires valid numeric angle or second point.
ERRO : Function cancelled
Specify rotation angle <0>:
Enter attribute values
REFERENCIA DE NIVEL <RN>:
LOCAL <LOCAL>:

////////////////////////////////////////////////////////////////////////////////////

//////////////////// NEW LSP

 

 

(DEFUN C:NI () (C:AT-NIVELX))
;............................
(DEFUN C:AT-NIVELX ()
(SETQ FLAGOK nil)
;
(IF (NOT FLAG-XLS) (AT-LEARQXLS) )
;
(SETQ DCL_ID (LOAD_DIALOG "STANDARD"))
(SETQ FLAGOK1 T)
(SETQ XFIM1   0)
;
(WHILE FLAGOK1
 (NEW_DIALOG "AT_TELA_NIVEL" DCL_ID)
 (START_LIST  "LAREAS") (MAPCAR 'ADD_LIST LLAREAS) (END_LIST)
 (IF (NOT NLA) (SETQ NLA "0"))
 (IF (NOT NIVEPR) (SETQ NIVEPR "+"))
 (SET_TILE    "LAREAS"   NLA)
 (SET_TILE    "NIVEPR"   NIVEPR)
 (ACTION_TILE "LAREAS" "(SETQ NLA $value)")
 (ACTION_TILE "NIVEPR" "(SETQ NIVEPR $value)")
 (ACTION_TILE "BT-INDICANIVEL" "(DONE_DIALOG 1)")
 (ACTION_TILE "BT-SAIR"       "(DONE_DIALOG 0)")
 (SETQ   XFIM1  (START_DIALOG))
 
 ;
 (IF (=  XFIM1 0) (SETQ FLAGOK1 nil))
 (IF (=  XFIM1 1) (AT-AREA-INDICARPONx))
)
;
(PRINC)
)
;...............................................................................////////// ERRO LSP
(DEFUN AT-AREA-INDICARPONx ()

(COMMAND "_UNDO" "_BEGIN")
(IF SALVA (SALVA (LIST "OSMODE" "CLAYER" "TEXTSTYLE")))
(SETVAR "OSMODE" 0)
;(SETQ FLAGOK1 nil)
;(IF (NOT FLAGAA)(ALERT "\n Informe um ponto!"))(SETQ FLAGIJ T)
;
(SETQ VVBL "STANDARD-SNIVEL")
(VERIFICA-VVBL VVBL);
    (COMMAND "_INSERT" VVBL ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) )
    ;
    (SETQ PTSI1 (GETPOINT"\n>>Selecione um Ponto Interno <ENTER=Fim>: "))
;
(IF RESTAURA (RESTAURA))
(COMMAND "_UNDO" "_END")
;
)

 

 

////////////////////////////////////////////////////////////////////////////////////

///////////////////// ORIGINAL LSP OK

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:AX () (C:AT-AREASX))
;............................
(DEFUN C:AT-AREASX ()
(SETQ FLAGOK nil)
;
(IF (NOT FLAG-XLS) (AT-LEARQXLS) )
;
(SETQ DCL_ID (LOAD_DIALOG "STANDARD"))
(SETQ FLAGOK1 T)
(SETQ XFIM1   0)
;
(WHILE FLAGOK1
 (NEW_DIALOG "AT_TELA_AREAS" DCL_ID)
 (START_LIST  "LAREAS") (MAPCAR 'ADD_LIST LLAREAS) (END_LIST)
 (START_LIST  "LREVES") (MAPCAR 'ADD_LIST LLREVES) (END_LIST)
 (IF (NOT NLA) (SETQ NLA "0"))
 (IF (NOT NLR) (SETQ NLR "0"))
 (IF (NOT NIVEPR) (SETQ NIVEPR "+"))
 (SET_TILE    "LAREAS"   NLA)
 (SET_TILE    "LREVES"   NLR)
 (SET_TILE    "NIVEPR"   NIVEPR)
 (ACTION_TILE "LAREAS" "(SETQ NLA $value)")
 (ACTION_TILE "LREVES" "(SETQ NLR $value)")
 (ACTION_TILE "NIVEPR" "(SETQ NIVEPR $value)")
 (ACTION_TILE "BT-SELECIONAR" "(DONE_DIALOG 1)")
 (ACTION_TILE "BT-INDICARPON" "(DONE_DIALOG 2)")
 (ACTION_TILE "BT-SAIR"       "(DONE_DIALOG 0)")
 (SETQ   XFIM1  (START_DIALOG))
 
 ;
 (IF (=  XFIM1 0) (SETQ FLAGOK1 nil))
 (IF (=  XFIM1 1) (AT-AREA-SELECIONAR))
 (IF (=  XFIM1 2) (AT-AREA-INDICARPON))
)
;
(PRINC)
)
;...............................................................................
(DEFUN AT-AREA-SELECIONAR ()

(COMMAND "_UNDO" "_BEGIN")
(IF SALVA (SALVA (LIST "OSMODE" "CLAYER" "TEXTSTYLE")))
(SETVAR "OSMODE" 0)
;(SETQ FLAGOK1 nil)
;(IF (NOT FLAGAA)(ALERT "\nSELECIONE UM POLIGONO!"))(SETQ FLAGIJ T)
;
(SETQ VVBL "STANDARD-AREA")
(VERIFICA-VVBL VVBL)
;
(SETQ FLAGX T)
(SETQ ENTS1 (ENTSEL"\n>>Selecione um poligono <ENTER=Fim>: "))
(WHILE FLAGX
 (SETQ FLAGA T)
 (WHILE FLAGA
   (IF (NOT ENTS1) (PROGN (SETQ FLAGA nil)(SETQ FLAGX nil)))
   (IF FLAGX
      (PROGN
      (SETQ ENT1  (CAR  ENTS1))
      (SETQ PT1   (CADR ENTS1))
      (SETQ LL1   (ENTGET ENT1))
      (SETQ TIPO  (CDR (ASSOC 0 LL1)))
      (IF (OR (= TIPO "LWPOLYLINE")(= TIPO "REGION"))
          (SETQ FLAGA nil)
          (ALERT "OBJETO SELECIONADO NÃO É UM POLIGONO!")
      )
      )
   )
 )
 ;
 (IF FLAGX
    (PROGN
    (COMMAND "_AREA" "_O" ENT1)
    (SETQ VVAREA (STRCAT (RTOS (GETVAR "AREA") 2 2) "m²"))
    (SETQ VCENT      (AT-CENTROID ENT1))
    (COMMAND "_INSERT" VVBL VCENT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) (NTH (ATOI NLR) LLREVE2) )
    ;
    (SETQ ENTS1 (ENTSEL"\n>>Selecione um poligono <ENTER=Fim>: "))
    )
 )
)
;
(IF RESTAURA (RESTAURA))
(COMMAND "_UNDO" "_END")
;
)
;...............................................................................
(DEFUN AT-AREA-INDICARPON ()

(COMMAND "_UNDO" "_BEGIN")
(IF SALVA (SALVA (LIST "OSMODE" "CLAYER" "TEXTSTYLE")))
(SETVAR "OSMODE" 0)
;(SETQ FLAGOK1 nil)
;(IF (NOT FLAGAA)(ALERT "\nSELECIONE UM POLIGONO!"))(SETQ FLAGIJ T)
;
(SETQ VVBL "STANDARD-AREA")
(VERIFICA-VVBL VVBL)
;
(SETQ FLAGX T)
(SETQ PTSI1 (GETPOINT"\n>>Selecione um Ponto Interno <ENTER=Fim>: "))
(WHILE FLAGX
 (SETQ FLAGA T)
 (WHILE FLAGA
   (IF (NOT PTSI1) (PROGN (SETQ FLAGA nil)(SETQ FLAGX nil)))
   (IF FLAGX
      (PROGN
      (SETQ HANX (CDR (ASSOC 5 (ENTGET (ENTLAST)))))
      (COMMAND "_-BOUNDARY" PTSI1 "")
      (SETQ HANY (CDR (ASSOC 5 (ENTGET (ENTLAST)))))
      (IF (= HANX HANY)
          (PROGN
          (ALERT "*** NÃO FOI POSSIVEL CRIAR UM POLIGONO! ***\nVERIFIQUE SE É UMA AREA FECHADA\nOU CONGELE ALGUMAS CAMADAS QUE POSSAM INTERFERIR!")
          (SETQ FLAGX nil)
          )
   (PROGN
         ;(COMMAND "_REGION" (ENTLAST) "")
          (SETQ ENTL (ENTLAST))
   (SETQ FLAGA nil)
   )
      )
      )
   )
 )
 ;
 (IF FLAGX
    (PROGN
    (SETQ ENTL (ENTLAST))
    (COMMAND "_AREA" "_O" ENTL)
    (SETQ VVAREA (STRCAT (RTOS (GETVAR "AREA") 2 2) "m²"))
    (SETQ VCENT      (AT-CENTROID ENTL))
    (COMMAND "_INSERT" VVBL VCENT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) (NTH (ATOI NLR) LLREVE2) )
    ;
    (SETQ PTSI1 (GETPOINT"\n>>Selecione um Ponto Interno <ENTER=Fim>: "))
    )
 )
)
;
(IF RESTAURA (RESTAURA))
(COMMAND "_UNDO" "_END")
;
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 Likes
Accepted solutions (3)
4,408 Views
21 Replies
Replies (21)
Message 2 of 22

DannyNL
Advisor
Advisor

As far as I can see you are forgetting to provide an insertion point for your block.

 

You new code that gives an error:

 (COMMAND "_INSERT" VVBL ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) )

The old code that works fine:

 (SETQ VCENT (AT-CENTROID ENTL))
 (COMMAND "_INSERT" VVBL VCENT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) (NTH (ATOI NLR) LLREVE2) )

So in your new code you will have to insert an insertion point to get it to work.

Message 3 of 22

rolisonfelipe
Collaborator
Collaborator

(SETQ VINSERT    (GETPOINT))
    (COMMAND "_INSERT" VVBL VINSERT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) )
    ;
    (SETQ PTSI1 (GETPOINT"\n>>Selecione um Ponto Interno <ENTER=Fim>: "))
;
(IF RESTAURA (RESTAURA))
(COMMAND "_UNDO" "_END")

 


the present modification has been as follows:
the video1 error retained when working straight at the levelx
the video2 inserts the block, takes advantage of something of the areax, but in the sequence the information is inserted incorrectly, and out of scale and even having a variable to control the block.
in both test the object snap job off, and not complete

i see the command in http://www.cadtutor.net/tutorials/autolisp/quick-start.php ,

0 Likes
Message 4 of 22

rolisonfelipe
Collaborator
Collaborator

the block size error was corrected, the scale of the source file was disproportionate, but the other errors could not adjust

0 Likes
Message 5 of 22

DannyNL
Advisor
Advisor

Looking at your second block after exploding in video 2, it only show 2 attributes as far as I can tell. But you are supplying 3 attribute values, so that is one too many.

 

(COMMAND "_INSERT" VVBL VINSERT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) )
|----| |----| |----------------------|
^ ^ ^
Attribute 1 ------| | |---- Attribute 3???
|---- Attribute 2

So you probably need to change it to

(COMMAND "_INSERT" VVBL VINSERT ESCALA "" "" VVAREA NIVEPR)
Message 6 of 22

rolisonfelipe
Collaborator
Collaborator

APPLYING THE ABOVE MODIFICATIONS, STILL THE ERROR IN VIDEO 1 AND 2 ARE ACTIVE

0 Likes
Message 7 of 22

rolisonfelipe
Collaborator
Collaborator

if you observe video 1 and 2, it is noted that the level block informs the calculated area in square meters, and in programming lsp level there is no programming of area calculation, as soon it is noticed that the level lsp performs the text in the block not by the name of the variable, but in a sequential way, from top to bottom and still dependent on executing the lsp area before

0 Likes
Message 8 of 22

DannyNL
Advisor
Advisor

I have no clue as I cannot test the code and try for myself, but in that case the error is probably caused by providing an invalid value to the command.

After you run the code and get the error, check the values of the variables to see if something is missing or wrong.

 

To check, run the code and wait for the error. After the error type the variable names on the commandline prefixed with a ! (= exclamation point, not 1 or L). So after the error, type:

!VVAREA

!NIVEPR

!NLA

!LLAREA2

 

And see if one of them is nil or is not a string value, as this will give you an error when trying to fill the attributes.

0 Likes
Message 9 of 22

rolisonfelipe
Collaborator
Collaborator

 

Command: *Cancel*

Command: *Cancel*

Command: *Cancel*

Command: !VVAREA
nil

Command: !NIVEPR
"+"

Command: !NLA
"0"

Command: !LLAREA2
("Á. SERV." "ÁREA DE SERVIÇOS" "ÁREA GOURMET" "COPA" "COZINHA" "DISPENSA"
"REFEITÓRIO" "SALA/COPA" "SALA/COPA/COZINHA" "LAVABO" "SACADA"
"------------------------------------" "CIRC." "CIRCULAÇÃO" "HALL"
"------------------------------------" "ESCRITÓRIO" "HOME OFFICE" "HOME
THEATER" "SALA" "SALA DE ESTAR" "SALA DE T.V" "SALA DE VISITAS"
"------------------------------------" "BANHO" "DORMITÓRIO" "SAUNA" "SUÍTE"
"CLOSET" "------------------------------------" "ÁREA DE CHURRASCO" "ÁREA DE
FESTAS" "ÁREA DE LAZER" "ÁREA DE PISCINA" "PLAYGROUND"
"------------------------------------" "ESTACIONAMENTO" "GARAGEM"
"------------------------------------" ">>ESCOLA" "BIBLIOTECA" "DIRETORIA"
"DISPENSA" "IS. FEM" "IS. P.N.E." "IS.MASC." "SECRETARIA"
"------------------------------------" ">> HOSPITAL/CLINICAS" "C.M.
FONAUDIOLOGO" "C.M. ORTOPEDISTA" "C.M. PEDIATRA" "C.M. PSIQUIATRA" "CONSULTORIO
MÉDICO" "ENFERMARIA" "QUARTO DE OBSERVAÇÃO" "SALA CIRUGICA" "SALA DE ESPERA"
"SALA DE MEDICAMENTOS" "------------------------------------")

Command:
Command:

0 Likes
Message 10 of 22

rolisonfelipe
Collaborator
Collaborator

VIDEO TEST

0 Likes
Message 11 of 22

DannyNL
Advisor
Advisor
Accepted solution

Ok, there you have the cause of your error. The VVAREA is nil and this is causing an error.

 

(COMMAND "_INSERT" VVBL VINSERT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) )
|----| |----| |----------------------|
^ ^ ^
nil = ERROR ------| | |---- "Á. SERV."
|---- "+"

 

In your other code the VVAREA is calculated by:

 

(DEFUN AT-AREA-INDICARPON ()
...
...
    (COMMAND "_AREA" "_O" ENTL)
    (SETQ VVAREA (STRCAT (RTOS (GETVAR "AREA") 2 2) "m²"))
    (SETQ VCENT      (AT-CENTROID ENTL))
    (COMMAND "_INSERT" VVBL VCENT ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) (NTH (ATOI NLR) LLREVE2) )
...

However, in your code with the error VVAREA is not calculated and nil.

 

(DEFUN AT-AREA-INDICARPONx ()
...
...
; Missing VVAREA calculation! <-- (COMMAND "_INSERT" VVBL ESCALA "" "" VVAREA NIVEPR (NTH (ATOI NLA) LLAREA2) )

But then again, looking at your block in one of the previous videos I only count two attributes after exploding and you are providing three; VVAREA, NIVEPR and (NTH (ATOI NLA) LLAREA2).

So which values values do you need to have in your block attributes?

Message 12 of 22

rolisonfelipe
Collaborator
Collaborator

I NEED VARIABLE NIVPR FOR LEVEL, AND LLAREA2 FOR ENVIRONMENTS, BY WHICH I UNDERSTAND ...

0 Likes
Message 13 of 22

DannyNL
Advisor
Advisor

What are the commands that are executed when you press the different buttons in the toolbar?

 

Because currently the VVAREA is relying in what order you execute the commands. The reason why it works the second time is because the VVAREA is used from the previous command. So if you want to be able to use the command that gives an error without the need of running the first command, then you need to make sure that all values needed are also calculated in the command that now gives an error.

 

Regarding the NIVEPR I'm not sure why it only contains the "+" and not the typed in value.

In the code there is an ACTION_TILE for NIVEPR, but has the used DCL the right key name for that value?

0 Likes
Message 14 of 22

DannyNL
Advisor
Advisor

Ok, so what variable do you want to have in the LOCAL attribute tag and what value do you want in the RN attribute tag?

0 Likes
Message 15 of 22

rolisonfelipe
Collaborator
Collaborator

LAST MODIFY.

 

(DEFUN AT-AREA-INDICARPONx ()

(COMMAND "_UNDO" "_BEGIN")
(IF SALVA (SALVA (LIST "OSMODE" "CLAYER" "TEXTSTYLE")))
(SETVAR "OSMODE" 0)
;(SETQ FLAGOK1 nil)
;(IF (NOT FLAGAA)(ALERT "\n Informe um ponto!"))(SETQ FLAGIJ T)
;
(SETQ VVBL "STANDARD-SNIVEL")
(VERIFICA-VVBL VVBL);
(SETQ VINSERT (GETPOINT))
    (COMMAND "_INSERT" VVBL VINSERT ESCALA "" "" NIVEPR (NTH (ATOI NLA) LLAREA2) )
    ;
    (SETQ PTSI1 (GETPOINT"\n>>Selecione um Ponto Interno <ENTER=Fim>: "))
;
(IF RESTAURA (RESTAURA))
(COMMAND "_UNDO" "_END")
;
)

 

 

>>>>>>>>>>>WE HAD THE FIRST SUCCESS, BUT THE LSP LEVEL WHEN IT STARTED ONLY, IT DOES NOT OPERATE CORRECTLY, BUT AFTER THE EXPLANATION OF THE AREA LSP, IT IS ANSWERING OK, ALTHOUGH THE OSMODE SHOULD BE WITH ALL OPERATING FUNCTIONS. WHAT ELSE WOULD YOU TELL ME FOR A HAPPY END FOR THAT LSP...

0 Likes
Message 16 of 22

DannyNL
Advisor
Advisor

The NIVEPR variable is set by the line

...
 (ACTION_TILE "NIVEPR" "(SETQ NIVEPR $value)")
...

But the key "NIVEPR" needs to be configured in the DCL file for the text box at RN.

As you have modified the DCL", I'm assuming you might have renamed the key to RN as well probably.

 

Can you post the code of the DCL-file STANDARD.DCL?

 

0 Likes
Message 17 of 22

rolisonfelipe
Collaborator
Collaborator

DCL FILE

0 Likes
Message 18 of 22

DannyNL
Advisor
Advisor
Accepted solution

Your DCL looks good and the NIVEPR key name is set correctly.

But why it shows only '+' in your video I have no clue.

 

...
:edit_box {label = "RN";key = "NIVEPR";edit_width=20;}
...

 

When I run the code below, the NIVEPR variable is correctly set with the value as filled into the dialogue box.

 

(DEFUN C:AT-NIVELX ()
(SETQ FLAGOK nil)
;
(IF (NOT FLAG-XLS) (AT-LEARQXLS) )
;
(SETQ DCL_ID (LOAD_DIALOG "STANDARD"))
(SETQ FLAGOK1 T)
(SETQ XFIM1   0)
;
(WHILE FLAGOK1
 (NEW_DIALOG "AT_TELA_NIVEL" DCL_ID)
 (START_LIST  "LAREAS") (MAPCAR 'ADD_LIST LLAREAS) (END_LIST)
 (IF (NOT NLA) (SETQ NLA "0"))
 (IF (NOT NIVEPR) (SETQ NIVEPR "+"))
 (SET_TILE    "LAREAS"   NLA)
 (SET_TILE    "NIVEPR"   NIVEPR)
 (ACTION_TILE "LAREAS" "(SETQ NLA $value)")
 (ACTION_TILE "NIVEPR" "(SETQ NIVEPR $value)") ;<-- Set NIVEPR correctly to test value +10.000
 (ACTION_TILE "BT-INDICANIVEL" "(DONE_DIALOG 1)")
 (ACTION_TILE "BT-SAIR"       "(DONE_DIALOG 0)")
 (SETQ   XFIM1  (START_DIALOG))
 
 ;
 (IF (=  XFIM1 0) (SETQ FLAGOK1 nil))
 (IF (=  XFIM1 1) (AT-AREA-INDICARPONx))
)
;
(PRINC)
)

(DEFUN AT-AREA-INDICARPONx ()
; 
(COMMAND "_UNDO" "_BEGIN")
(IF SALVA (SALVA (LIST "OSMODE" "CLAYER" "TEXTSTYLE")))
(SETVAR "OSMODE" 0)
;(SETQ FLAGOK1 nil)
;(IF (NOT FLAGAA)(ALERT "\n Informe um ponto!"))(SETQ FLAGIJ T)
;
(SETQ VVBL "STANDARD-SNIVEL")
(VERIFICA-VVBL VVBL)
(SETQ VINSERT (GETPOINT))
    (COMMAND "_INSERT" VVBL VINSERT ESCALA "" "" NIVEPR (NTH (ATOI NLA) LLAREA2) ) ;<-- At this point value of NIVEPR is still +10.000 when testing
    ;
    (SETQ PTSI1 (GETPOINT"\n>>Selecione um Ponto Interno <ENTER=Fim>: "))
;
(IF RESTAURA (RESTAURA))
(COMMAND "_UNDO" "_END")
;
)

As the code above does seem to work I have no idea why it gets the wrong value when you run it.

Did you already did a restart of AutoCAD just to make sure you do not get any old values from previous tests? Can you check with (findfile "STANDARD.DCL") that the right DCL file is being loaded as well?

 

Message 19 of 22

rolisonfelipe
Collaborator
Collaborator

how best valor for 

........
(IF SALVA (SALVA (LIST "OSMODE" "CLAYER" "TEXTSTYLE")))
(SETVAR "OSMODE" 0) <---- NEW VALOR FOR INSERT THE BLOCK NEXT LINE, OR ON LINE. BECAUSE THE BLOCK INSERT FREE IN DRAWING.
.........

 

 

 

Sets running object snaps.
Type: Bitcode
Saved in: Registry
Initial value: 4133
The setting is stored as a bitcode using the sum of the following values:
0 NONe
1 ENDpoint
2 MIDpoint
4 CENter
8 NODe
16 QUAdrant
32 INTersection
64 INSertion
128 PERpendicular
256 TANgent
512 NEArest
1024 Geometric CEnter
2048 APParent Intersection
4096 EXTension
8192 PARallel
16384 Suppresses the current running object snaps
To specify more than one running object snap, enter the sum of their values. For example, entering 3 specifies the Endpoint (bitcode 1) and Midpoint (bitcode 2) object snaps.
Note: Developers creating custom routines can use the 16384 bitcode to temporarily suppress the current running object snap settings without losing the original settings.

0 Likes
Message 20 of 22

DannyNL
Advisor
Advisor
Accepted solution

If you just want to make sure the block is inserted exactly on the line near the point you click with the mouse, you use NEAREST (512).