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

I didn't want to interfere with other valuable information that was being shared in other topics and try and focus on one issue, so:

Prl, or anyone!
Can you explain why there are universal and noticeable differences/discrepancies when importing into other cad programs an originally drawn 3d block and/or nested 3d block Dcad file that was exported as a dwg 2000 file from Dcad 3d max v22, in either 3d mode or 2d mode? I know you know this but just to clarify, In other words a dwg export from 3d mode gives different results than if you were to export from 2d mode. This is a definite bug, no? Is there a fix for this? Does it need to be so complicated to be able to create a standard block then share this as a dwg file? Creating /sharing blocks are a standard practice in most other cad programs. 
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

I've been spending a lot of my free time with blocks and exporting to SU. With 16.3 the dwg export worked as expected - and the 3D block could have any Z value. In 22.1 this is not the case.

Prl is absolutely correct - a Z value of 0 provides a work around that allows the dwg export to work. IMHO this is a bug. We are simply trying to find the simplest work around so that we can carry on. With 22.1 exporting with a non zero Z value produces a wrong but repeatable result. For instance if I set all block handles to a Z value of 10 cm then all cabinets are imported into SU offset.

I have experimented with various export configurations including 2000, 2004 and 2007 and they produce the same results - at least for me. It also works as expected exporting with 2D or 3D - however my drawings are always built in 3D.

Also - I always have to rotate the SU drawings regardless if exporting in 2D or 3D.

I am also experiencing the odd rectangular solid showing up with an extra line going from one corner to an adjacent corner.


Garry K

If I set the Z value of the blocks to 10 cm - it is offset after export by 20 cm.
If I set the Z value to -20 cm - it is offset after export by -40 cm.

This pattern is repeatable. My guess is that they added the Z value during export instead of subtracting it.

Should be very easy for DC to fix.

prl

Dean,

In the past DesignCAD 3d blocks gave me such strange export results I stopped using DesignCAD blocks completely even within DesignCAD. Nobody wants to build something with flawed blocks.

Recent work by Minstrel renewed my interest in them and even though there still seem to be flaws, I believe reasonable fixes are right around the corner.

The best thing you can do is post small sample drawings of what is working and what isn't working.  I study and pull apart these sample drawings trying to find out the triggers for the failures.  Once I can repeatedly produce an error and a work-around, I have something to present to Dt and the beta folks.

And thank you for your suggestion(s).  The exporting a 3d model from 2d mode is still something I need to study some more. DesignCAD lets you do so many combinations of things, some by design, some as "hey all, watch this", it presents endless hours of study.


MarkX

A workaround (well, it worked once) when it is inconvenient to move the actual model to Z=0 is to set the workplane so that the handle that is defined when the block is created is at Z=0 (or just as easily 0,0,0 ).

Mark

Dean

#5
Garry,
Thanks for your time> the information and your macro, It works great!.
Though I don't wish to focus primarily on your drawing but I guess we need examples. concerning your drawing, when I exported from dcad v22 a 2000 dwg file then imported into a different cad program : (I'm sure as you intended them to be) all individual  blocks appeared to be in their original coordinates, which is great! The only difference is that when exported from Dcad's 2d mode then imported into another cad program I needed to rotate the whole unit  in the "z-axis 180 degrees and the origin appears to be around 25" down from 0,0,0 the top backside of the base unit and when exported from 3d mode I needed to rotate 90 degrees in the 'x'axis  and the bottom back left corner of the unit comes in at the origin 0,0,0. I'll have to find version 16 but I don't think I have it any more. The oldest version I have is I think v12 and I have the manual book!
So, is prl's fix a universal fix generally speaking because I'm seeing many different results with different drawings? Sometimes the Dcad 3d dwg block exports work for me as I intended them too and other times all the blocks are dis-in orientated and I have no idea what I did!  Thanks.

edit> ok prl, I just read your post and you're right. posting small sample drawings is the best way to find out anything. I will try my best as well to help and Thank you!
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

#6
Quote from: Garry K on January 07, 2013, 08:01:45 AM
If I set the Z value of the blocks to 10 cm - it is offset after export by 20 cm.
If I set the Z value to -20 cm - it is offset after export by -40 cm.

This pattern is repeatable. My guess is that they added the Z value during export instead of subtracting it.

GarryK

Nice job! I did notice the double offset.  I've backed up from the export routine to the native "block define" command. My question being, why is the "block define" command recording and embedding the block's absolute position in 3d space in the block definition?  It shouldn't. Once you set the block define handle regardless of where you are in 3d space, that point should be the block's 0,0,0, not 0,0,10 or where ever you just happen to be while making the block. 

With this flawed embedded block origin definition, you also get an offset affect when the block's instance insertion point is computed relative to a flawed block origin . Definitely shows up in exports but doesn't show up natively in DesignCAD.  Some spaghetti fixes in there somewhere.

Edit:  What complicates all this is that DesignCAD records several offsets.  There is the base drawing global XYZ system at absolute 0, 0,0, then their are drawing handles if loading a symbol which don't necessarily need to be at the symbol's 0,0,0 and then there are the insertion points.  All of these offsets to offsets result in some serious coordinate recomputing for the block or symbol.

Dean

Prl,
Here is a small test file for you to check out. I know you have your hands full! There is only one block in this file. I thought that it's better this way for experimenting with it. I'll be adding more to it later and will post it as a revision.
If you have any questions let me know. With this attached file when I export as a 2000 dwg file from Dacd v22 while either in 2d mode or 3d mode then import the dwg into another cad program the 3d entities are not displaying correctly.
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, 11:12:03 AM
I know you have your hands full! There is only one block in this file.

Thanks Dean, DesignCAD is addictive and does distract me from work that actually puts food on the table . . . but these sort of distractions have paid dividends in expanded DesignCAD capabilities for me in the past. 

Continue to post as you can.  I'll do the same though I may be out of the loop for a few days.


prl

#9
Quote from: Dean on January 07, 2013, 11:12:03 AM
Here is a small test file for you to check out. I know you have your hands full! There is only one block in this file. I thought that it's better this way for experimenting with it. I'll be

Took a fast look. In 3d mode, the file suffers from the Z zero issue.  Use the below code to fix it.  Select your original grid based bowling pin, set a handle at the bottom point like you did before and in place of "block define", use the below "bdfix.d3m" code.  When it asks you for a name, select "Pin" to overwrite the current block. 

Within DesignCAD, everything should look like it did before (no visible change) but you can now export this normally to SU.  (Don't do your 2d mode export trick.  That one I don't get yet and everything is upside down in it when I tried it).

' Program: bdfix.d3m  (block define fix)

'1/7/2013 - changed to have it only zero out the z coordinate.  x, y seem not to matter.
'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 version 18 and up.

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

'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 - in this case using the convert option
regen
>BlockDefine
{
<Type 0
}

'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

Dean

#10
Prl,
This is very interesting! I exported the dcad v22 "3d block file" as a 2000 dwg file from Dcad while in 2d mode
Then imported the dwg file back into Dcad while in 2d mode, the blocks were not in the correct locations as I stated early.
Then I exported the dwg file while in 2d mode from Dcad
Then opened the dwg file in another cad program and sketch up and it displayed correctly ll! HUH!  Somehow the importing and exporting rectified the issue with the blocks coordinates. I don't get it. But it seems to work. So far! I wish we could attach dwg files .

>Thanks prl, I'm also going to test your macro
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

Dr PR

Here are two questions about the block export problem:

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?

DesignCAD is perfectly happy to use a 3D file as a 2D drawing, as many people have learned the hard way. It will allow objects to have non-zero Z values, and that really confuses the intersection routines. It also allowed some very odd "2D" file exports that didn't work in other programs. I wonder if the 2D export routines do some housekeeping before writing the export files?

Phil
DesignCAD user since 1987

prl

Quote from: Dean on January 07, 2013, 12:03:09 PM
This is very interesting! I exported the dcad v22 "3d block file" as a 2000 dwg file from Dcad while in 2d mode
Then imported the dwg file back into Dcad while in 2d mode, the blocks were not in the correct locations as I stated early.

Wow Dean!!  Tremendous discovery.   An export -reimport-export from 2d mode.   Canceling out all the backward sign conventions.

Keep going . . . . . 

Dean

Prl,
"sometimes ya gotta turn it the other way to get it to work "I can thank my grandfather for that saying!
The results appear to be consistent with the dcad 3d block drawing I posted. I'm going to try it using more blocks and nested blocks but if it doesn't work;
Concerning your macro>In Dcad I exported a dwg from 3d mode, the macro worked, after executing it then exporting the dwg and then importing it to another program the results were: the blocks maintained  their correct locations on the extruded plane though all entities had to be rotated in the "x" axis 90 degrees.Also the plane that was used in the extrude stayed in its original position. The grid bowling pin moved and the curve stayed its original position. I attached a picture displaying the exported dwg after I imported it into Dcad. So, should I use the macro on all 3d blocks and their nested blocks?
  Thanks for writing that macro. That it outstanding work!
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

#14
Dean, regarding the "bdfix.3m", I get it to do everything cleanly, no issues at all with the extra plane or the line that didn't move.  Can't explain your results at the moment.

With a normal DesignCAD export, yes you will need to rotate about the x axis in SU.  In the other thread, I posted a ruby script for that.

"bdfix.d3m" should work on all blocks and nested blocks etc.  For all block defines, use the bdfix.d3m. Don't mix at the moment.


Edit:  added some pictures and also your original file with my bdfix routine applied.  Did nothing else to your file.