DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Exported dwg 3d blocks

Started by Dean, January 07, 2013, 05:51:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dean

Prl,
Everything works as you suggest only when I choose "convert to block" during your macro executing. If I choose "retain block" during the macro I get what you see in the attached picture every time. The picture is showing right after I executed the macro. See the plane, line and grid bowling pin. Also ,your macro appears to corrupt the dcad file when I choose "retain" when re-defining the grid bowling pin block. There is no "undo", well, the plane goes back to position but not the grid bowling pin. and sometimes I lose all entities in view except the grid bowling pin and can't get it back I haven't  found yet exactly what happens. I'll keep you informed. The rotate ruby works in sku, Thanks again.
DesignCad 3D max 2021
Lenovo 17.3"Laptop Intel(R) Core(TM) i7-9750H CPU @ 2.6GHz/Turbo boost 6 cores 12 threads.16GB memory.SSD 256GB/HDD 1TB 7200 Rpm.Nvidia Graphics GeForce GTX 1660 Ti 6GB
Windows 10 Home 64 bit

prl

Quote from: Dean on January 07, 2013, 02:53:13 PM
Everything works as you suggest only when I choose "convert to block" during your macro executing.

True, I have it coded for the "convert" option.  If it stands the test of time and more rigorous usage , I'll try and improve it.

Dean

Prl.
Thanks and that's some great work you are doing. I wouldn't even know where to start to write a macro like that. I'll let you know if I find anything else.

"quote from phil"
1. Do you see problems if you use DXF/DWG version R12? Perhaps the problem is in the DesignCAD translator for the newer version DXF/DWG formats. The older versions of DesignCAD did not support the newer versions of DXF/DWG. Maybe that is why block export works better in older versions of DesignCAD.

2. Does export from the 2D version work better because it automatically forces Z=0 for the block handles?

"

Phil,
The results are the same when exporting the original dcad file I posted as a dwg from Dcad v22 in any dwg version. I'm not quite sure about #2. 
DesignCad 3D max 2021
Lenovo 17.3"Laptop Intel(R) Core(TM) i7-9750H CPU @ 2.6GHz/Turbo boost 6 cores 12 threads.16GB memory.SSD 256GB/HDD 1TB 7200 Rpm.Nvidia Graphics GeForce GTX 1660 Ti 6GB
Windows 10 Home 64 bit

prl

#18
Dean,

Please put this version through your tests.  You should be able to select any of the options (Convert, Retain, Delete).  If it fails, let me know what it isn't doing correctly.

' Program: bdfix2.d3m  (block define fix)


'1/7/2013 - added code so user can use any of the block options (convert, retain, delete, or cancel)
'1/7/2013 - change to z coordinate only, x and y do not seem to be affected
'1/6/2013

'Notes - intended for use when creating blocks in DesignCAD that may at some point be exported.
'        The routine lets the user block define blocks WITHOUT worrying about the handle location.
'        For DC 18 and up

if sys(80)=0 then
  Message "Nothing selected. . . press any key to continue"
  END
end if

'sys(80) doesn't give proper selected entities count when grids are involved
gosub getselected

'corrected selected items count
csel = maxsel
csys9 = sys(9) 'current total entities

'save current handle position in 3d space
xc = sys(190)
yc = sys(191)
zc = sys(202)

'zero out z position of the selection by moving it to the drawing origin
>dragmove
{
<pointxyz [xc,yc,0]
}

'now block define it
regen
>BlockDefine
{
}

'determine which option the user selected (convert, retain, delete)
if sys(9) = csys9 - csel then 'user selected delete option
   regen
   End
endif

if sys(9) = csys9 - csel + 1 then 'user selected convert option
  'select the last item created, the block
  sys(80)=0
  getattr sys(9), type, select
  putattr sys(9), type, 1
 
  'now with the block properly zeroed, put it back to where the user had it
  >sethandle
  {
  <type 0
  <pointxyz [xc,yc,0]
  }
 
  >dragmove
  {
  <pointxyz [xc,yc,zc]
  }
 
  sys(80)=0
  regen
  End
endif

'if routine has not ended by this time, user selected retain or canceled, in any case
'put the selected items back to original location
>sethandle
{
<type 0
<pointxyz [xc,yc,0]
}

>dragmove
{
<pointxyz [xc,yc,zc]
}
sys(80)=0
regen

End


'subroutines follow

getselected: 'correct entity count
    maxsel = sys(80)
    tglcount = 0 'total grid line counter
   
    for j = 1 to maxsel
      getselect j, ent
      entity ent
      if sys(90) = 32 then 'grid header, check for number of grid lines
         glcount = sys(99) 'grid line count
         for jj = 1 to glcount
           tglcount = tglcount + 1
         next jj
      endif
    next j
    sys(1)=0
   
    precision 0
   
    'add the missing grid lines to the count
    for j = 1 to tglcount
        maxsel = maxsel + 1
    next j
return

Dean

#19
Prl,
You did it! everything works! With the bdfix2 macro. Good job.
That 1st macro corrupted my original file. After I used the macro with the"retain"as block option then cIosed  the file >chose "no" to save changes then when I re-opened  the file in Dcad  in 2d mode all entities would be visible then I would go to 3d mode and all that was visible was the grid bowling pin. Everything else was gone! Then back to 2d mode and there was only the pin, Weird.I had to open it in V20.0 then save it in 3d mode then open it in V22.1 then save it again. It appears ok now. I'll stick with bdfix2 there doesn't appear to be any after effects on the file.
I also tested ;
In Dcad v22.1 while continually staying in "2d mode" 1st> dwg export >2nd started a new file>dwg import>dwg export>3rd started a new file>dwg import option all within Dcad on 3d nested blocks  and it appears to work. All blocks are back in their place. Also, all  the entities in other cad programs are facing up in the"z" axis, I don't get it!
I also tested this while in 3d mode and the results are noticeable different. Maybe that should be a seperate thread! It would be great to be able to export from either 2d mode or 3d mode and achieve the same results. I think I'll stick with using your macro.
Thanks so much for everything I have learned so much from this and this is going to help my workflow tremendously.

I forgot to mention that I achieve consistent good results using your macro bdfix2 while exporting the dwg 2000 file from Dcad while in 3d mode, as you have specified previously.

DesignCad 3D max 2021
Lenovo 17.3"Laptop Intel(R) Core(TM) i7-9750H CPU @ 2.6GHz/Turbo boost 6 cores 12 threads.16GB memory.SSD 256GB/HDD 1TB 7200 Rpm.Nvidia Graphics GeForce GTX 1660 Ti 6GB
Windows 10 Home 64 bit

Garry K

Here is an interesting one. I build a corner shelf and cut out 2 dadoes. I then create a block. Somehow DC gets the geometry mixed up and when it gets imported into SU it appears in reverse color.

However, if I then mirror the solid and then create a block and export it then the colors are correct.

Conversely - if I mirror a solid and create a block colors are reversed.

This appears to be a case where 2 wrongs make a right - or should I say look into a mirror that looks into a mirror ... This can give   a guy a headache.


Dr PR

Garry,

If you perform a solid Boolean operation the resulting solid may display incorrectly when shaded. The screwed up display appears to be because the original object has screwed up "normals" (a property used to determine the direction of shadows).

If you mirror the solid the mirrored copy will display OK. Most of the time, but not always.

Also, sometimes mirroring a solid will cause the mirrored copy to have screwed up shading.

What you are seeing in Sketchup is directly related to the bugs in DesignCAD.

This is a reported bug, and it has been around a long time. It was supposed to have been fixed in V22.1. What version are you using?

Phil


DesignCAD user since 1987

Garry K

Phil,

I'm using 22.1.

I do have to mirror cabinets from time to time. Is there any work around or fix that you know of?

Dr PR

Garry,

If you save the file, close it, and reopen it all of the normals will be OK.

I always do this before creating image files - otherwise there will be some tiny reversed normal that I don't see until after I look at the image file and then it will stand out like sunlight reflecting off a mirror!

This should work for you before you export to Sketchup. If it doesn't please post. We could be seeing more than one problem.

****

Another trick that sometimes works is to create a new solid somewhere off to the side of the original object with screwed up normals. Then use "Solid Subtract" to subtract the new solid from the work piece. Of course since the new solid doesn't overlap the original solid nothing will be subtracted (the new solid will disappear) but this seems to cause DesignCAD to examine the original solid very carefully and it often cleans up reversed normals, internal surfaces, multiple facets on a planar surface, etc.

Phil
DesignCAD user since 1987

minstrel

Quote from: prl on January 07, 2013, 06:15:36 PM
Dean, Please put this version through your tests.
' Program: bdfix2.d3m  (block define fix)

...and I've been running my own.

This is W-O-N-D-E-R-F-U-L  prl !  It's as if i just downloaded a 'new' version of DesignCAD!

Thank you!  and thanks to all involved in the process.

Minstrel

prl

Quote from: minstrel on January 08, 2013, 12:00:19 AM
Thank you!  and thanks to all involved in the process.

Minstrel,  good!  Keep pushing on the 3d front . . . you've opened new frontiers for this old DesignCAD program.


prl

Dean,

Learned something new with your bowling pin file.  DesignCAD point marks and construction lines export perfectly to SU.  The construction lines (rays) surprised me.

minstrel

#27
Quote from: prl on January 08, 2013, 01:35:37 AM
Keep pushing on the 3d front . . .

Prl, just to 'stir the waters' on this one, a bit...
...Is it possible to execute a 'bdfix.d3m' within a new macro to a 'selection' of planes? 

Where it would apply 'bdfix.d3m' and assign a consecutive integer/name to each plane until all of the
planes in the 'selection' are processed.

Naturally, this greatly enhance the workflow when numerous planes are involved.
Thanks, as always!


prl

Quote from: minstrel on August 27, 2014, 01:27:07 AM
Prl, just to 'stir the waters' on this one, a bit...

Minstrel, let's explore your suggestion. You want to cycle a DesignCAD selection set, and individually create a DesignCAD block for each plane using a consecutive integer/name.  Then I guess you are exporting to SketchUP.

I wonder what magic trick you are onto.  I'll look into this on the weekend.  And please let me know if I understood the concept correctly.


minstrel

Quote from: prl on August 27, 2014, 07:24:50 AM
Then I guess you are exporting to SketchUP.
...I tried not to mention that 8)...and yes, you know exactly what I'm after.


Quote from: prl on August 27, 2014, 07:24:50 AM
I wonder what magic trick you are onto.
Just adding a little more 'shine' to a star!

Look forward to your efforts!