Author Topic: Entmake after layer creation throws exception!  (Read 7355 times)

0 Members and 1 Guest are viewing this topic.

zoltan

  • Guest
Entmake after layer creation throws exception!
« on: December 18, 2005, 05:17:12 PM »
This is driving me nuts!  I create a line with EntMakeX and in the DXF list I have a routine that checks if a layer exists.  If not it creates the layer and assignes it the color specified.
like this.

(EntMakeX (List '(0 . "LINE") (Cons 8 (CheckLayerName "Maintained" 8)) '(10 0.0 0.0 0.0) '(11 0.0 0.0 0.0)))

The layer is created correctly and the color is set, but when it gets back to the EntMakeX, it thows an exception:
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)

when you try to save the drawing, AutoCAD crashes with a CER.

This is AutoCAD 2006

I have attached the file, let me know if you guy get the same result.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Entmake after layer creation throws exception!
« Reply #1 on: December 18, 2005, 05:35:07 PM »
Nope....

Command: crashme
<Entity name: 7ef7df10>

Worked first time/everytime.....although this isn't Vanilla Acad. This was tested with the "Land Enabled Map" option of Land Desktop 2006, SP1.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Entmake after layer creation throws exception!
« Reply #2 on: December 18, 2005, 06:19:40 PM »
Why are you defining the line with zero length ?

I seems to work as expected if there is a differential between start and endpoints.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Entmake after layer creation throws exception!
« Reply #3 on: December 18, 2005, 06:31:21 PM »
..and yes, in AC2006 the posted code spits the dummy

; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
_$

.. continuable sometimes ..
then FATAL ERROR if save attempted
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #4 on: December 18, 2005, 07:48:49 PM »
It's most likely crashing because you haven't assigned an owner to the newly created object - then when it goes to save...BOOM!
EntMakeX creates an entity, but it DOES NOT assign an owner to that entity. Try using EntMake instead.

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Entmake after layer creation throws exception!
« Reply #5 on: December 18, 2005, 08:11:11 PM »
DUH ! I Couldn't see the forest for the trees ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #6 on: December 18, 2005, 08:26:53 PM »
That twice in less than a week Kerry  :-D :-D :-D

Merry Xmas,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Entmake after layer creation throws exception!
« Reply #7 on: December 18, 2005, 09:15:11 PM »
 :cry:


Seasons Greeting to you too Glenn

Be Well
Kerry

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

zoltan

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #8 on: December 18, 2005, 10:56:21 PM »
I am defining a line with 0 length because I will be moving the endpoints later with EntMod.  Making them different still crashes for me.  Also I need the ENAME so I don't want to use EntMake, beside it still crashes.  I just installed Service Pack 1a for Mechanical Desktop and it still crashes.  I have Inventor Series 10 loaded.

Glenn, please explain to me this idea of assigning an owner to an object after making it, because that is new to me.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Entmake after layer creation throws exception!
« Reply #9 on: December 18, 2005, 11:43:29 PM »
Just change the EntMakeX to EntMake.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

SMadsen

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #10 on: December 19, 2005, 05:25:13 AM »
Zoltan, if the only thing you want is to have an ename returned you should be able to grab it after using ENTMAKE. For built-in functions that mess with the drawing database, it's far more important what the function does than what it returns.

A simple inline example of grabbing the ename could be:
Code: [Select]
(cond ((entmake (list '(0 . "LINE")
                      (cons 8 (CheckLayerName "Maintained" 8))
                      '(10 0.0 0.0 0.0)
                      '(11 20.0 10.0 0.0)
                )
       )
       (setq ename (entlast))
      )
)

zoltan

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #11 on: December 19, 2005, 09:34:58 AM »
Using Entmake instead of EntmakeX still causes an exception for me.

 So what is the difference between EntMake and EntMakeX.  I always thaught that the first returns the EData and the latter returns the EName.  So what is this stuff about assigning an owner? How do you do thais in Lisp?

LE

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #12 on: December 19, 2005, 09:53:21 AM »
I do not have A2006.

What happens if you use visual lisp activex function instead of entmake ?

zoltan

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #13 on: December 19, 2005, 09:58:54 AM »
Ok, I figured out this stuff about owning objects.

When I use VLA-AddLine, it thows and exception and crashes imediatelly with a CER

zoltan

  • Guest
Re: Entmake after layer creation throws exception!
« Reply #14 on: December 19, 2005, 10:16:01 AM »
ok, Sorry, VLA-AddLine works, I just did'nt change it for all of them.

That is the way it will have to be then.