Author Topic: Converting AcDbModelerGeometry class entities  (Read 3048 times)

0 Members and 1 Guest are viewing this topic.

S.Langhammer

  • Guest
Converting AcDbModelerGeometry class entities
« on: May 23, 2013, 09:39:57 AM »
Hello again,
I need something to convert all 3dSolids, regions, surfaces and bodies within a drawing to something, that actually holds dxf information, faces for example.

Until now I did that by walking through the entire modelspace and subentities within inserts, converting every single one of them with a copy paste method:

Code - Auto/Visual Lisp: [Select]
  1. (defun getSATLst(inLst movX movY movZ / entTyp entity movVec vX vY vZ)
  2.         (foreach SATName inLst
  3.                 (cond
  4.                         ((wcmatch (setq entity(entget SATName)entTyp(cdr(assoc 0 entity))) "3DSOLID,REGION,SURFACE,BODY")
  5.                                 (if (setq cbf (getvar 'clipboardformat))(progn
  6.                                         (cond
  7.                                                 ((=(getvar '_VERNUM) "13.1.8 (UNICODE)") (setvar 'clipboardformat 19))
  8.                                                 ((=(getvar '_VERNUM) "13.2.4 (UNICODE)") (setvar 'clipboardformat 22))
  9.                                         )
  10.                                         (command "_.copybase" "_non" '(0.0 0.0 0.0) SATName "" "_.pasteclip" "_non" (list movX movY movZ))
  11.                                         (setvar 'clipboardformat cbf)
  12.                                 ))     
  13.                         )
  14.                         ((= "INSERT" entTyp)
  15.                                 (setq movVec(trans(cdr(assoc 10 entity))(cdr(assoc 210 entity))0)
  16.                                           vX (car   movVec)
  17.                                           vY (cadr  movVec)
  18.                                           vZ (caddr movVec)    
  19.                                 )
  20.                                 (getSATLst(Blk_ENameLstNstd(cdr(assoc 2 entity))) vX vY vZ)
  21.                         )
  22.                 )
  23.         )
  24.         (princ)
  25. )
  26.  

You might notice it's a: inefficient, because it has to walk through every insert in the model space
                              b: very slow, when you have a lot of entities within the model space
                              c: depending on which version of BricsCAD is used.

Since this is going to be part of a software, which is going to be sold to customers, I have to fix at least c and b.
I could easiely read out the information in groopcodes 1, 2 and 3, yet the other side of the interface this is for can't handle whats inside there.

The best possible solution would work within the actual blocks and on entities in the modelspace, run fast and doesn't require the copy paste method I used so far.
Thanks for the help!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Converting AcDbModelerGeometry class entities
« Reply #1 on: May 24, 2013, 03:13:48 PM »
Is it an option to first save the entire drawing to R11/12?
You can use the SAVEASR12 command to do this.

fixo

  • Guest
Re: Converting AcDbModelerGeometry class entities
« Reply #2 on: May 24, 2013, 04:19:41 PM »
My guess is to set temporarilly visual style to 2dframe
probably it may helps

S.Langhammer

  • Guest
Re: Converting AcDbModelerGeometry class entities
« Reply #3 on: May 27, 2013, 03:33:01 AM »
@roy
The problem about the save format is, that that changes with the versions. For example, in BricsCAD 13.1.8 R11/12 was resembled (is that the right word?) by 19, in 13.2.4 it's 22. In future versions it surely will move on, eventually R11/12 will be dropped to. I don't know what variety of versions our clients might use. Maybe someone still has BricsCAD 12 or any other halfway functioning version.
So I need to find something version independent.

If I can't figure out something functional, that converts directly I'll have to do it the hard way:
Let  function walk through all Inserts -> save  the name (or whatever is needed) of the top Insert -> check if any nested Insert or the top Insert contains any AcDbModelerGeometry  entities -> automatize refedit, so it makes all subnodes accessable -> explode the hell out of every AcDbModelerGeometry  entity, till there are only lines left.

That would kill a lot of actual bodies and give the Delphi side of the interface a lot of lines to read, but it would at least work somehow.

@fixo:
CAD-noob me has to ask: a) How would that be done? b) Would that practically change the information within the block table?
A rough discription would be enough to give me an idea about it.

Thank you!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Converting AcDbModelerGeometry class entities
« Reply #4 on: May 27, 2013, 07:17:53 AM »
The problem about the save format is...
The SAVEASR12 command has been around for a long time (since before? BricsCAD V7).
But you can always use this instead:
Code - Auto/Visual Lisp: [Select]
  1. (setvar 'filedia 0)
  2. (command "_.saveas" "r12" "YourPath/YourFileName.dwg"
  3. (setvar 'filedia 1)
BTW: You may have to reopen the R12 dwg.