Author Topic: An error has occurred inside the *error* function  (Read 5893 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
An error has occurred inside the *error* function
« on: October 05, 2007, 02:32:05 PM »
I'm getting said message (thread title) in an ODCL program that was working just a little while ago.  It's bombing out at the insert command below and my eyes are starting to hurt from looking at code all morning.

Anyone have any thoughts on this?  Please tell me there's a stupid-simple mistake in here somewhere.

Code: [Select]
(defun c:Devices_frmDevices_cmdInsert_OnClicked ( / sSelKey sSelText rValue xValue xText grp)
   (setq sSelKey (dcl_Tree_GetSelectedItem Devices_frmDevices_TreeControl))
   (setq sSelText (dcl_Tree_GetItemText Devices_frmDevices_TreeControl sSelKey))

   (setq rValue (dcl_Tree_GetParent Devices_frmDevices_TreeControl sSelKey))
   (setq xValue (dcl_Tree_GetParent Devices_frmDevices_TreeControl rValue))

   (setq xText  (dcl_Tree_GetItemText Devices_frmDevices_TreeControl xValue))

   (setq grp (dictsearch (namedobjdict) "AECB_DEVICE_STYLES"))
   (if (setq g2 (dictsearch (cdr (assoc -1 grp)) sSelText))
      (progn
         (princ (strcat "\n Insert device " sSelText "  (Press Enter to end command)"))
         (command "-AecbDeviceAdd" "sy" "Standard" "st" sSelText "l" "o")
         (while (> (getvar "cmdactive") 0) (command pause))
      )
      (progn
         (princ (strcat "\n Insert device " sSelText "  (Press Enter to end command)"))
         (command "-insert" (strcat "*S:\\CADDdata\\MEP_2008\\Content\\Aecb Content\\US Imperial\\Electrical\\Devices\\" xText) "0,0" "" "")
         (command "-AecbDeviceAdd" "sy" "Standard" "st" sSelText "l" "o")
         (while (> (getvar "cmdactive") 0) (command pause))
      )
   )
   (princ)
)


And here's what AutoCAD spits out at the command line...

Code: [Select]
Command:
 Insert device Single Pole Switch (to remain)  (Press Enter to end command);
error: An error has occurred inside the *error* functioninvalid AutoCAD
command: nil

T.Willey

  • Needs a day job
  • Posts: 5251
Re: An error has occurred inside the *error* function
« Reply #1 on: October 05, 2007, 02:38:54 PM »
When I get a cryptic error message like that, I reset the error function to nil and rerun the program to see what is the true error.

(setq *error* nil)

See if this gets you more information on what is going wrong.  On a quick look, do you answer all the prompts to the insert command?  Doesn't it ask you for the insertion point, x scale, y scale, and rotation?

This worked for me, so I'm guessing you need one more enter ( "" ).

Command: (command "_.insert" "cir-note" '(0.0 0.0 0.0) "" "" "")
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #2 on: October 05, 2007, 02:54:01 PM »
Invalid AutoCAD command?!?!  I'm not changing the insert command anywhere so......??

Quote
Command:
 Insert device Infrared Beam  (Press Enter to end command); error: invalid
AutoCAD command: nil

T.Willey

  • Needs a day job
  • Posts: 5251
Re: An error has occurred inside the *error* function
« Reply #3 on: October 05, 2007, 03:11:01 PM »
Does the object get inserted?  If so, then it's the next command.  If not, then try it with a period in front like in my last post.

If that doesn't solve it, then turn on 'cmdecho' and post the whole command line from when you call the routine.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #4 on: October 05, 2007, 03:32:13 PM »
Does the object get inserted?  If so, then it's the next command.  If not, then try it with a period in front like in my last post.
Nope.  Tried it your way and still no dice.

Quote
If that doesn't solve it, then turn on 'cmdecho' and post the whole command line from when you call the routine.

Echo is on and I'm getting the same thing at the command line.

Quote
Command:
 Insert device Relay Switch  (Press Enter to end command); error: An error has
occurred inside the *error* functioninvalid AutoCAD command: nil

This is getting really frustrating because it was working earlier...

Could it have something to do with wanting to explode the block upon insertion??

Code: [Select]
(command "-insert" (strcat "*S:\\CADDdata\\MEP_2008\\Content\\Aecb Content\\US Imperial\\Electrical\\Devices\\" xText) "0,0" "" "")

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #5 on: October 05, 2007, 03:36:03 PM »
And just for ha-ha's, I tried it in Civil 3D (it's designed to be run in MEP 2008 but I commented out the MEP stuff) and this is what I got.

Quote
Command:
Command: ; error: bad argument type: lentityp nil

 :?

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #6 on: October 05, 2007, 03:45:43 PM »
And the other thing that's weird is that I'm using a similar INSERT call in another OpenDCL app and that one works perfectly fine!

I've double-checked the variables and they're all correct.  *sigh*  :|

T.Willey

  • Needs a day job
  • Posts: 5251
Re: An error has occurred inside the *error* function
« Reply #7 on: October 05, 2007, 03:51:41 PM »
Comment out the command below the insert, and see what that brings.

I don't see anything inherent in the code that looks wrong, so I'm not sure what is happening.  Sorry this is all guess work on my part.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #8 on: October 05, 2007, 04:00:31 PM »
Comment out the command below the insert, and see what that brings.

I don't see anything inherent in the code that looks wrong, so I'm not sure what is happening.  Sorry this is all guess work on my part.

Already did that... It still poops the bed! :x

T.Willey

  • Needs a day job
  • Posts: 5251
Re: An error has occurred inside the *error* function
« Reply #9 on: October 05, 2007, 04:09:03 PM »
Comment out the insert command, and see if it likes it.  If that doesn't work I don't what else to try since you are only call built in commands in those places.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #10 on: October 05, 2007, 04:10:58 PM »
Comment out the insert command, and see if it likes it.  If that doesn't work I don't what else to try since you are only call built in commands in those places.

I'm pretty sure I've already tried that but let me give it another shot...

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #11 on: October 05, 2007, 04:16:07 PM »
It's got to be the ODCL file *&@$'ing everything up because I just had the IT guys restore the files from yesterday and it's working fine now.
 :realmad: (not towards OpenDCL - just the fact that I have NO idea how it got geeked out like it did!)

P.S. Owen.... That's one BAD @$$ program you've got there.  I was a little intimidated by it at first, but after a few days I'm flying through it.  :-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: An error has occurred inside the *error* function
« Reply #12 on: October 05, 2007, 04:22:13 PM »
That was the last idea I had.  I'm glad you got it working Matt.  That is the frustrating part of debugging.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: An error has occurred inside the *error* function
« Reply #13 on: October 05, 2007, 04:24:46 PM »
It is all the code from your routine? the one you posted here?

Many times, that error happens when using setvar and getvar from a non existing or valid predefined values. (just what I remember)

Guest

  • Guest
Re: An error has occurred inside the *error* function
« Reply #14 on: October 05, 2007, 04:27:52 PM »
It is all the code from your routine? the one you posted here?

Many times, that error happens when using setvar and getvar from a non existing or valid predefined values. (just what I remember)

That was just a itty bitty snippet of the overall monster.  And the only setvar or getvar that I'm using is in this line (which comes after the drawing is supposed to be inserted).

Code: [Select]
(while (> (getvar "cmdactive") 0) (command pause))