Author Topic: entget 3dsolid  (Read 4317 times)

0 Members and 1 Guest are viewing this topic.

Jan ter Aij

  • Guest
entget 3dsolid
« on: September 24, 2008, 01:13:44 PM »
When I use:
Code: [Select]
(command "_.SPHERE" '(0 0) 1)(setq e (entlast))
(entget e)
I get in AutoCAD 2008 something:
Code: [Select]
((-1 . <Entity name: 7efa3408>) (0 . "3DSOLID")
(330 . <Entity name: 7efa1cf8>)
(5 . "1B9") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0")
(100 . "AcDbModelerGeometry") (70 . 1)
(1 . "mnmoo i m mi           ")
(1 . "ni ^*+0;:,4 ^*+0\\^[ nh ^LR nmqoqnqgmo QK o  ")
(1 . "n fqfffffffffffffffj:rooh n:rono ")
(1 . ">,27:>;:- {rn rn _nn mnmqoqnqgmo |")
(1 . "=0;& {rn rn {rn {m {rn {rn |")
(1 . "3*2/ {rn rn {rn {rn {l {n |")
(1 . ",7:33 {rn rn {rn {rn {rn {k {rn {m |")
(1 . "9><: {rn rn {rn {rn {rn {l {rn {j 90-(>-; ,6183: |")
(1 . ",/7:-:r,*-9><: {rn rn {rn o o o n n o o o o n 90-(>-;@) V V V V |")
(100 . "AcDb3dSolid") (350 . <Entity name: 7efa3420>))

It looks encrypted, can this be decrypt and used in combination
with entmake.
This program is doing nothing:
Code: [Select]
(defun c:msphere ()
(entmake
'((0 . "3DSOLID") (100 . "AcDbEntity") (67 . 0) (410 . "Model")
(8 . "0") (100 . "AcDbModelerGeometry") (70 . 1)
(1 . "mnmoo i m mi           ")
(1 . "ni ^*+0;:,4 ^*+0\\^[ nh ^LR nmqoqnqgmo QK o  ")
(1 . "n fqfffffffffffffffj:rooh n:rono ")
(1 . ">,27:>;:- {rn rn _nn mnmqoqnqgmo |")
(1 . "=0;& {rn rn {rn {m {rn {rn |")
(1 . "3*2/ {rn rn {rn {rn {l {n |")
(1 . ",7:33 {rn rn {rn {rn {rn {k {rn {m |")
(1 . "9><: {rn rn {rn {rn {rn {l {rn {j 90-(>-; ,6183: |")
(1 . ",/7:-:r,*-9><: {rn rn {rn o o o n n o o o o n 90-(>-;@) V V V V |")
(100 . "AcDb3dSolid")
;(350 . <Entity name: 7efa4458>)
  )
)
)

Regards
« Last Edit: September 24, 2008, 02:01:03 PM by Jan ter Aij »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: entget 3dsolid
« Reply #1 on: September 24, 2008, 03:45:47 PM »
The little I pretend to know about acis solids is that the encoding scheme is based on xoring. In a nutshell xor the ascii code for each character in the 1 groups with 95 -- unless it's a space.

eg -

Code: [Select]
(defun foo ( acis_data )
    (   (lambda ( bar )
            (mapcar
               '(lambda ( x ) (if (eq 1 (car x)) (cons 1 (bar (cdr x))) x))           
                acis_data
            )       
        )
        (lambda ( string )
            (vl-list->string
                (mapcar
                   '(lambda ( x ) (if (eq 32 x) x (boole 6 95 x)))
                    (vl-string->list string)
                )
            )
        )   
    )   
)

Assuming ename is an entity name for an acis solid, then --

Code: [Select]
(foo (entget ename))
Returns --

Code: [Select]
(
    (-1 . <Entity name: 70677de8>)
    (0 . "3DSOLID")
    (330 . <Entity name: 70677d18>)
    (5 . "3D")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "0")
    (100 . "AcDbModelerGeometry")
    (70 . 1)
    (1 . "20800 6 2 0           ")
    (1 . "16 \001utodesk \001uto\003\001\004 17 \001\023\r 6.0.5.7004 \016\024 24 \027ed \023ep 24 13:32:39 2008 ")
    (1 . "25.399999999999999 9.9999999999999995e-007 1e-010 ")
    (1 . "asmheader $-1 -1 \00012 208.0.5.7004 #")
    (1 . "body $-1 -1 $-1 $2 $-1 $-1 #")
    (1 . "lump $-1 -1 $-1 $-1 $3 $1 #")
    (1 . "shell $-1 -1 $-1 $-1 $-1 $4 $-1 $2 #")
    (1 . "face $-1 -1 $-1 $-1 $-1 $3 $-1 $5 forward single #")
    (1 . "sphere-surface $-1 -1 $-1 0 0 0 1 1 0 0 0 0 1 forward\037v \t \t \t \t #")   
)

But ... it's a moot point, because you have to have to provide the encoded data for entmake to be successful.

eg (excluding -1, 5, 330 and 360 group codes) --

Code: [Select]
(entmake
   '(
        (0 . "3DSOLID")
        (100 . "AcDbEntity")
        (67 . 0)
        (410 . "Model")
        (8 . "0")
        (100 . "AcDbModelerGeometry")
        (70 . 1)
        (1 . "mogoo i m o           ")
        (1 . "ni ^*+0;:,4 ^*+0\\^[ nh ^LR iqoqjqhook QK mk H:; L:/ mk nleomeog moog ")
        (1 . "mjqlffffffffffffff fqfffffffffffffffj:rooh n:rono ")
        (1 . ">,27:>;:- {rn rn _nm mogqoqjqhook |")
        (1 . "=0;& {rn rn {rn {m {rn {rn |")
        (1 . "3*2/ {rn rn {rn {rn {l {n |")
        (1 . ",7:33 {rn rn {rn {rn {rn {k {rn {m |")
        (1 . "9><: {rn rn {rn {rn {rn {l {rn {j 90-(>-; ,6183: |")
        (1 . ",/7:-:r,*-9><: {rn rn {rn o o o n n o o o o n 90-(>-;@) V V V V |")
    )
)

Later.
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Spike Wilbury

  • Guest
Re: entget 3dsolid
« Reply #2 on: September 24, 2008, 04:58:29 PM »
and no idea if RegionGet (autolisp function) might help... it is one of those functions that one end up doing just to kill time...

here:

http://www.theswamp.org/index.php?topic=24035.msg290766#msg290766

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: entget 3dsolid
« Reply #3 on: September 25, 2008, 02:59:29 AM »

I get in AutoCAD 2008 something

Hello!
In acad 2008, for creation 3dsolid it is necessary to use necessarily 330 group dxf!
Your example and my editing:

Code: [Select]
(defun c:msphere ()
 (entupd
  (entmakex
   (list
    '(0 . "3DSOLID")
    '(100 . "AcDbEntity")
    '(67 . 0)
    '(410 . "Model")
    '(8 . "0")
    '(100 . "AcDbModelerGeometry")
    '(70 . 1)
    '(1 . "mnmoo i m mi           ")
    '(1 . "ni ^*+0;:,4 ^*+0\\^[ nh ^LR nmqoqnqgmo QK o  ")
    '(1 . "n fqfffffffffffffffj:rooh n:rono ")
    '(1 . ">,27:>;:- {rn rn _nn mnmqoqnqgmo |")
    '(1 . "=0;& {rn rn {rn {m {rn {rn |")
    '(1 . "3*2/ {rn rn {rn {rn {l {n |")
    '(1 . ",7:33 {rn rn {rn {rn {rn {k {rn {m |")
    '(1 . "9><: {rn rn {rn {rn {rn {l {rn {j 90-(>-; ,6183: |")
    '(1 . ",/7:-:r,*-9><: {rn rn {rn o o o n n o o o o n 90-(>-;@) V V V V |")
    '(100 . "AcDb3dSolid")
    (cons 350 (cdr (assoc 330 (entget (namedobjdict)))))
   ) ;_  list
  ) ;_  entmakex
 ) ;_  entupd
)
PS.
1. dxf formats 2004 and 2008 are incompatible!
2. 350 group contains record of history of creation of object, in my code, this history delete...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: entget 3dsolid
« Reply #4 on: September 25, 2008, 10:22:05 AM »

Jan ter Aij

  • Guest
Re: entget 3dsolid
« Reply #5 on: September 26, 2008, 03:05:43 AM »
Thanks for the information

With your information and the routines from Wronzky http://ww3.cad.de/foren/ubb/Forum145/HTML/001309.shtml#000007
Code: [Select]
(defun get-decoded-ele-data (objekt / liste data)
  (decode-code-ele-data (entget objekt))
)
(defun decode-code-ele-data (data / liste)
  (foreach n data
    (progn
      (if (= (car n) 1)
        (setq liste (cons (cons 1 (decode-code-acis (cdr n))) liste))
        (setq liste (cons n liste))
      )
    )
  )
  (reverse liste)
)
(defun decode-code-acis (s / n l)
  (setq n "")
  (while (> (strlen s) 0)
    (setq l (substr s 1 1)
          s (substr s 2)
          n (strcat n (if (= " " l)
                        " "
                        (chr (- 159 (ascii l)))
                      )
            )
    )
  )
)
I can make in AutoCAD 2008:
Code: [Select]
(defun c:msphere17 ()
(setq sphere_center (getpoint "\nSphere center:"))
(setq sphere_radius (getdist sphere_center "\nSphere radius:"))
(entupd
(entmakex (decode-code-ele-data
(list
'(0 . "3DSOLID") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model")
'(8 . "0") '(100 . "AcDbModelerGeometry") '(70 . 1)
'(1 . "21200 6 2 26           ")
'(1 . "16 Autodesk AutoCAD 17 ASM 12.0.1.820 NT 0  ")
'(1 . "1.0 0.0 0.0")
'(1 . "asmheader $-1 -1 @11 212.0.1.820 #")
'(1 . "body $-1 -1 $-1 $2 $-1 $-1 #")
'(1 . "lump $-1 -1 $-1 $-1 $3 $1 #")
'(1 . "shell $-1 -1 $-1 $-1 $-1 $4 $-1 $2 #")
'(1 . "face $-1 -1 $-1 $-1 $-1 $3 $-1 $5 forward single #")
(cons 1 (strcat "sphere-surface $-1 -1 $-1 "
(rtos (car sphere_center) 2 8) " "
(rtos (cadr sphere_center) 2 8) " "
(rtos (last sphere_center) 2 8) " "
(rtos sphere_radius 2 8)
" 1 0 0 0 0 1 forward_v I I I I #"))
'(100 . "AcDb3dSolid")
(cons 350 (cdr (assoc 330 (entget (namedobjdict)))))
) ;_  list
)) ;_  entmakex
) ;_  entupd
)

Regards