Author Topic: modelspace item collection is 1 (not 0) indexed in bricscad  (Read 3032 times)

0 Members and 1 Guest are viewing this topic.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
I was doing some testing, and getting a nil for:
(VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 0)

turns out, the first item is at:
(VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 1)

watch out!
James Maeding

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #1 on: June 23, 2015, 03:22:21 AM »
My tests... :wideeyed2:

 Empty DWG:
: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 1)
; error : Automation Error 80020009; [IAcadModelSpace] Error accessing [ITEM] method. ErrIndex=0;

: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 0)
; error : Automation Error 80020009; [IAcadModelSpace] Error accessing [ITEM] method. ErrIndex=0;


1 line dwg:
: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 0)
#<VLA-OBJECT IAcadLine 0000000015CD7EF0>

: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 1)
; error : Automation Error 80020009; [IAcadModelSpace] Error accessing [ITEM] method. ErrIndex=0;


Same AutoCAD Mec.2013/Bricscad V15


roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #2 on: June 23, 2015, 04:20:38 AM »
I can confirm the issue. The problem occurs if the first entity has been erased.
My test (BricsCAD V14.2.17):
1. Open a new drawing.
2. Create 4 entities in this order: line, circle, polyline, ellipse.
3. Erase the 1st and the 3rd entity.
4. Perform these tests:
Code: [Select]
: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 0)
nil
: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 1)
#<VLA-OBJECT IAcadCircle 0CAF1D60>
: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 2)
#<VLA-OBJECT IAcadEllipse 0CBC5ED8>
: (VLA-ITEM (VLA-GET-MODELSPACE (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) 3)

; error : Automation Error 80020009; [IAcadModelSpace] Error accessing [ITEM] method. ErrIndex=0;

EDIT: The problem occurs for all blocks.
EDIT: Support request has been sent.
« Last Edit: June 23, 2015, 04:48:47 AM by roy_043 »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #3 on: June 23, 2015, 06:21:13 AM »
EDIT: Support request has been sent.

Knowing Bricsys, I'll bet it will be fixed before the day is out  :-)

TMoses

  • Guest
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #4 on: June 23, 2015, 07:48:48 AM »
Dear All,
indeed, strange behaviour ... seems, the COM interface also treats erased objects (?), while in turn, the COM wrapper for erased objects is (correctly) not established, hence the final error ...

Of course, we will fix this quickly ...

@Lee
hmmmm - I will do my best to have you winning your bet :-)
in worst case, it will be fixed tomorrow :-)

Many greetings & many thanks to all !

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #5 on: June 23, 2015, 10:59:08 AM »
I see, erased ents affects things. Its funny because all kinds of bugs are tolerated if the software author fixes them in any reasonable amount of time - that would be 1 month or less for me. Not the story with the "A" team...
James Maeding

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #6 on: June 23, 2015, 12:29:08 PM »
@Lee
hmmmm - I will do my best to have you winning your bet :-)
in worst case, it will be fixed tomorrow :-)

No need to rush on my behalf  :-)
My lighthearted comment was simply a compliment for the outstanding BricsCAD support.

TMoses

  • Guest
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #7 on: June 23, 2015, 06:16:33 PM »
Dear All,

Lee has won his bet :-)
Fixed before 12 PM GMT :-)

In fact, it was a fault in Lisp's Fast-COM implementation ... the iterator instantiation was using the "allowErasedEntities" in opposite way; hence, the erased entities was also used, but for an erased entity, there is no COM instance, hence the NIL, as Roy reported.
The bug was for BlockTableRecords and SymbolTables.

A workaround until fixed BricsCAD is published (works in all versions) :

(if vle-fastcom (vle-fastcom nil))
(vla-item …)
(if vle-fastcom (vle-fastcom t))

this disables the Fast-COM implementation (using normal Windows COM then) for (vla-item) ... and same code also works on "A" CAD system as well :-)

Many greetings & many thanks for pointing to that bug !

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #8 on: June 24, 2015, 03:04:10 AM »
Thank you Torsten.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #9 on: June 24, 2015, 04:45:33 AM »
Many thanks Torsten!  :-)

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: modelspace item collection is 1 (not 0) indexed in bricscad
« Reply #10 on: June 24, 2015, 06:18:18 AM »
Also thanks Torsten for taking the time to post on this site, when there are issues like this one.