Author Topic: XRecord Bricscad - Autocad  (Read 3924 times)

0 Members and 1 Guest are viewing this topic.

Peter Guappa

  • Guest
XRecord Bricscad - Autocad
« on: December 17, 2011, 08:59:45 AM »
I have a problem with attaching Xrecord to a point in Bricscad and then opening this drawing in Autocad.



In Bricscad, I open a new drawing, add a point and attach Xrecord to it with:

(setq olddict (vlax-vla-object->ename (vla-GetExtensionDictionary (vlax-ename->vla-object (car (entsel))))))
(dictadd olddict "TESTXREC" (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") '(1 . "Text 1") '(2 . "Text 2") '(20 . 1) '(21 . 1.0))))



After I save this and try to open it in Autocad, I need to do a RECOVERY, because there was an error found in the drawing file.



When I do the same in Autocad and open the dwg in Bricscad: no problem.


What is wrong with my coding? (it is my first attempt to work with xrecords)


I'm working with Bricscad V12 pro/ AutoCad 2011

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: XRecord Bricscad - Autocad
« Reply #1 on: December 17, 2011, 11:10:17 AM »
My first thought was that the combinations of gc 20 and an integer might cause the error. But if I use your code BC correctly converts (20 . 1) to (20 . 1.0). I would try using gc 40-59 (Double-precision floating-point value) instead of gc 10-39 (Double precision 3D point value). Maybe AC expects 3 values (x, y and z) for the last group codes. But I don't have AC and therefore cannot if that is the case.

Try this to test if AC requires 3 values for gc 10-39:
Code: [Select]
(dictadd olddict "TESTXREC" (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "Text 1") (2 . "Text 2") (10 . 1.0) (20 . 1.0) (30 . 1.0))))
And also try this:
Code: [Select]
(dictadd olddict "TESTXREC" (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "Text 1") (2 . "Text 2") (40 . 1.0) (41 . 1.0))))
I would be interested in the BC drawing and the drawing after RECOVERY by AC.
« Last Edit: December 17, 2011, 11:20:31 AM by roy_043 »

Peter Guappa

  • Guest
Re: XRecord Bricscad - Autocad
« Reply #2 on: December 17, 2011, 03:24:40 PM »
Thx roy_043, it works with (40 . 1.0) (41 . 1.0)



My first thought was that the combinations of gc 20 and an integer might cause the error. But if I use your code BC correctly converts (20 . 1) to (20 . 1.0). I would try using gc 40-59 (Double-precision floating-point value) instead of gc 10-39 (Double precision 3D point value). Maybe AC expects 3 values (x, y and z) for the last group codes. But I don't have AC and therefore cannot if that is the case.

Try this to test if AC requires 3 values for gc 10-39:
Code: [Select]
(dictadd olddict "TESTXREC" (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "Text 1") (2 . "Text 2") (10 . 1.0) (20 . 1.0) (30 . 1.0))))
And also try this:
Code: [Select]
(dictadd olddict "TESTXREC" (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "Text 1") (2 . "Text 2") (40 . 1.0) (41 . 1.0))))
I would be interested in the BC drawing and the drawing after RECOVERY by AC.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: XRecord Bricscad - Autocad
« Reply #4 on: December 18, 2011, 07:21:22 AM »
I'm still interested in knowing if AC requires 3 values for gc 10-39. If the code in the first post is used in AC what do you get? Does AC add missing the coordinates?
Does:
'(... (20 . 1) (21 . 1.0))
Become:
'(... (10 . 0.0) (20 . 1.0) (30 . 0.0) (11 . 0.0) (21 . 1.0) (31 . 0.0))
?

Peter Guappa

  • Guest
Re: XRecord Bricscad - Autocad
« Reply #5 on: December 18, 2011, 08:53:24 AM »
@ Lee Mac : thx, gonna need this.

@ roy_043 : attached the dwg's with the code of my first post in BC and after RECOVER in AC




And these are the differences between AC - BC when trying to add codes 10 11 20 21 with single value

Autocad 2011


Command: (setq olddict (vlax-vla-object->ename (vla-GetExtensionDictionary (vlax-ename->vla-object (car (entsel))))))
Select object: <Entity name: 7ffffc03f70>


Command: (dictadd olddict "TESTXREC1" (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") '(20 . 1.0) '(21 . 1.0))))
<Entity name: 7ffffc05000> ;;; no error !!!!


Command: (setq dict (vlax-vla-object->ename (vla-GetExtensionDictionary (vlax-ename->vla-object (car (entsel))))))
Select object: <Entity name: 7ffffc03f70>


Command: (setq xget (dictsearch dict "TESTXREC1"))
((-1 . <Entity name: 7ffffc05000>) (0 . "XRECORD") (5 . "78") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ffffc03f70>) (102 . "}") (330 . <Entity name: 7ffffc03f70>) (100 . "AcDbXrecord") (280 . 1)) ;;; codes 20/21 not added !!!


Command: (dictadd olddict "TESTXREC" (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") '(10 . 1.0) '(11 . 1.0))))
; error: bad DXF group: (10 . 1.0)



Bricscad V12


: (setq olddict (vlax-vla-object->ename (vla-GetExtensionDictionary (vlax-ename->vla-object (car (entsel))))))
Select entity: <Entity name: 0431b300>


: (dictadd olddict "TESTXREC1" (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") '(20 . 1.0) '(21 . 1.0))))
<Entity name: 0431b558>


: (setq dict (vlax-vla-object->ename (vla-GetExtensionDictionary (vlax-ename->vla-object (car (entsel))))))
Select entity: <Entity name: 0431b300>


: (setq xget (dictsearch dict "TESTXREC1"))
((-1 . <Entity name: 0431b558>) (0 . "XRECORD") (5 . "43") (102 . "{ACAD_REACTORS") (330 . <Entity name: 0431b300>) (102 . "}") (330 . <Entity name: 0431b300>) (100 . "AcDbXrecord") (280 . 1) (20 . 1.0) (21 . 1.0))


: (dictadd olddict "TESTXREC" (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") '(10 . 1.0) '(11 . 1.0))))
; ----- Error around expression -----
'(11 . 1.0);
; error : bad argument type <(10 . 1.0)> ; expected <LIST> at [DXF/XED DATA]



I'm still interested in knowing if AC requires 3 values for gc 10-39. If the code in the first post is used in AC what do you get? Does AC add missing the coordinates?
Does:
'(... (20 . 1) (21 . 1.0))
Become:
'(... (10 . 0.0) (20 . 1.0) (30 . 0.0) (11 . 0.0) (21 . 1.0) (31 . 0.0))
?
« Last Edit: December 18, 2011, 09:55:57 AM by Peter Guappa »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: XRecord Bricscad - Autocad
« Reply #6 on: December 18, 2011, 03:02:44 PM »
In BC this works:
Code: [Select]
(dictadd olddict "TESTXREC" (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "Text 1") (2 . "Text 2") (10 1.0 0.0 0.0) (20 . 1.0) (30 . 1.0))))

My conclusion for BC:
gc 10-19 = Double precision 3D point value in this format: (19 1.5 1.0 0.0)
gc 20-39 = Double-precision floating-point value

TMoses

  • Guest
Re: XRecord Bricscad - Autocad
« Reply #7 on: January 30, 2012, 05:36:11 PM »
Dear All,
just my 2 cents here ...
In fact, the Adesk docs are a bit weak ... especially, the DXF docs (strictly spoken) apply to import from DXF file, there are delicate differences when used in application (API) context as with (entmake) + (entmakex).

From DXF docs :
10
 Primary point; this is the start point of a line or text entity, center of a circle, and so on
  DXF: X value of the primary point (followed by Y and Z value codes 20 and 30)
  APP: 3D point (list of three reals)

11–18 Other points
  DXF: X value of other points (followed by Y value codes 21–28 and Z value codes 31–38)
  APP: 3D point (list of three reals)
20, 30
  DXF™: Y and Z values of the primary point
21–28, 31–37
  DXF: Y and Z values of other points

here, "APP" means the API context ... as shown, for several GCs, it is not safely documented how it is interpreted in "APP" context ... AutoCAD in example does not accept GC 20, 21 ... as double values in (entmake) list ...

In opposite, Bricscad tries to be more tolerant and logical here ... thus, (21 . 1.0) is accepted, but if those values are stored to the drawing database (XRecord), it might cause problems in particular AutoCAD versions.

Btw, using GC 10 needs this format '(10 x y z) - there should be not dot in the list at all; both AutoCAD and Bricscad correctly reject that.

Thus, as Roy told, you can safely use GC 10...19 for true points (2d/3d), but range 20...39 is "forbidden";
in other words, I would suggest only to use such GCs, which are clearly documented, especially in "APP" context.

I hope I did not destroy all clarities ?  :wink:


It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: XRecord Bricscad - Autocad
« Reply #8 on: January 30, 2012, 08:08:30 PM »
Welcome to the Swamp TM   8-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: XRecord Bricscad - Autocad
« Reply #9 on: January 30, 2012, 09:36:27 PM »

Welcome to theSwamp Torsten   8-)
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.