Author Topic: Invalid Entity. What is that ?  (Read 370 times)

0 Members and 1 Guest are viewing this topic.

vincent.r

  • Newt
  • Posts: 42
Invalid Entity. What is that ?
« on: September 17, 2019, 01:32:52 AM »
I received a message from watch window of VL console. Do anybody gone through this error ? What is that ? Screenshot attached.
« Last Edit: September 17, 2019, 02:51:59 AM by vincent.r »

roy_043

  • Water Moccasin
  • Posts: 1731
  • BricsCAD 18
Re: Invalid Entity. What is that ?
« Reply #1 on: September 17, 2019, 04:21:08 AM »
You should indent your code better. And there is no reason to quote integers.

Code: [Select]
(setq LST (entget ent))Is perhaps the problem. Initially ent is nil.

VovKa

  • Swamp Rat
  • Posts: 1163
  • Ukraine
Re: Invalid Entity. What is that ?
« Reply #2 on: September 17, 2019, 05:08:37 AM »
What is that ?
there's something in your block that 'Inspect window' doesn't like
i don't think it could be fixed

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1013
  • Marco
Re: Invalid Entity. What is that ?
« Reply #3 on: September 17, 2019, 08:30:12 AM »
setq closest nil before run

jtoverka

  • Newt
  • Posts: 30
Re: Invalid Entity. What is that ?
« Reply #4 on: September 17, 2019, 09:02:07 AM »
setq closest nil before run

To build on this answer I would wrap the entire function in a lambda statement like so:

Code: [Select]
((lambda ( / ) ; insert local variables here

; insert all of your code here

)) ; close lambda function

The reason I use lambda is I don't need to make a function, however I need to localize my variables. I see that your code evaluates the variable closest in an if statement. When closest is not localized it will run "correctly" the first time, however if it is not set to nil the next time, it will run incorrectly. If you use lambda and put all the variables you use past the "/" the variables will be nil at the start of the program.

roy_043

  • Water Moccasin
  • Posts: 1731
  • BricsCAD 18
Re: Invalid Entity. What is that ?
« Reply #5 on: September 17, 2019, 09:24:12 AM »
The reason I use lambda is I don't need to make a function, however I need to localize my variables.
A lambda is also a function.

jtoverka

  • Newt
  • Posts: 30
Re: Invalid Entity. What is that ?
« Reply #6 on: September 17, 2019, 09:57:01 AM »
The reason I use lambda is I don't need to make a function, however I need to localize my variables.
A lambda is also a function.

In this context it is single use, notice how I didn't save it to a variable. Additionally, it is created then it is called once and never used again.
The defun creates a callable function and saves it to a variable. That is what I meant with "make a function."

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1013
  • Marco
Re: Invalid Entity. What is that ?
« Reply #7 on: September 17, 2019, 11:19:40 AM »
The reason I use lambda is I don't need to make a function, however I need to localize my variables.
A lambda is also a function.

In this context it is single use, notice how I didn't save it to a variable. Additionally, it is created then it is called once and never used again.
The defun creates a callable function and saves it to a variable. That is what I meant with "make a function."
)) ; close lambda function    :)

vincent.r

  • Newt
  • Posts: 42
Re: Invalid Entity. What is that ?
« Reply #8 on: September 18, 2019, 05:53:14 AM »
Thanks guys for your efforts. I tried in many ways but result was same. Then created block newly and it works fine. I believe problem was with block. Don't know why.
Thanks a lot guys for your kind help.