News:

Please note new Forum URL: forum.designcad.com

Main Menu
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.

Blocks in 3D

Started by Dr PR, December 17, 2012, 12:10:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

"Blocks" are a feature of DesignCAD that allow you to define a collection of objects as a block and then make multiple copies of the block throughout the drawing. After this you can change ALL copies of the block by just editing the original block. So if you have many copies of a particular object, say a door latch or light fixture, and you want to replace them all with a different door latch or light fixture, all you have to do is edit the original block.

Blocks also have the property that only one complete block exists in a drawing and all other instances are just small place holders. This makes the drawing smaller so it takes less disk space and loads and saves faster.

****

I decided to test the effects of blocks on system RAM useage and rendering time. My test file is shown in the attached picture. The basic objects were a red cube, green pyramid and blue sphere, selected together. These were arrayed in a 10x10x10 array with the original objects as the first objects in the array. Then they were shaded using Gouraud shading with hardware acceleration enabled. I used the Windows Task Manager "Performance" display to measure system RAM useage.

For reference:                                            RAM          RAM       RAM
                                                                  Used      Cached    Free
Vista 64 + Task Manager                           648 Mb   430 Mb    3126 Mb


Test 1. Create the three solids, select them and make the 10x10x10 array.

                                                                  RAM          RAM       RAM
                                                                  Used      Cached    Free
DesignCAD V22.1 + blank file                    743 Mb   493 Mb    2983 Mb
DesignCAD + 10x10x10 array of solids      825 Mb   508 Mb    2898 Mb
DesignCAD + Gouraud shaded array         834 Mb   507 Mb    2887 Mb
    Gouraud shading time = 10 seconds
    File size = 17,909 Kbytes

Test 2. Shut down DesignCAD and restart. Vista used a bit more RAM than the initial startup - possibly because some resources weren't freed up when DesignCAD shut down. This is why a bit more RAM was used when DesignCAD was started again.

Create the three solids, select them and define them to be a block using the "Convert to block" option. Select the block and create a 10x10x10 array of blocks.

                                                                  RAM          RAM       RAM
                                                                  Used      Cached    Free
DesignCAD V22.1 + blank file                    745 Mb   532 Mb    2952 Mb
DesignCAD + 10x10x10 array of blocks     746 Mb   532 Mb    2951 Mb
DesignCAD + Gouraud shaded array         749 Mb   533 Mb    2947 Mb
    Gouraud shading time = 1 second
    File size = 432 Kbytes

Note: I was skeptical about these results, especially the shading time. I shut down (power off) and restarted the machine, loaded DesignCAD and repeated the test with blocks. I got essentially the same results. The shading timing was actually 1.78 seconds, give or take a few hundred milliseconds while I pushed the stop button.

System RAM use was 95 Mbytes for the array of solids and 1 Mbyte for the array of blocks.        95:1
RAM use for shading the solids was 9 Mbytes and only 3 Mbytes for the blocks.                            3:1
Shading time for the solids was 10 seconds and only 1.8 second for the blocks.                         5.6:1
File size for the array of solids was 17,909 Kbytes and for the array of blocks was 432 Kbytes.   41:1

Note: An empty drawing is 48 Kbytes.

As you can see, if you have objects that repeat many times in a drawing, making them blocks can result in significant performance boosts.

****

In the test I noticed that shading times were much faster with blocks than with individual solids. In this case all blocks were oriented in exactly the same way, so shading for one was the same as shading for all. I tried a different test where I created a simple cylinder and defined it to be a block. Then I made six copies of the block and rotated each differently in three axes.

When I shaded (Gouraud with graphics acceleration enabled) them each different cylinder had it's own shadows and highlights - not all the same as the original block. It took about seven times as long to shade as an array of blocks that were all oriented the same way. Still, when I made a 10x10x10 array of the collection of seven blocks the rendering time was much faster than a similar array of ordinary cylinders.

Phil
DesignCAD user since 1987

Dr PR

I was curious about block behavior when they are transferred between drawings with copy/paste.

1. I opened a blank drawing "A" and drew a red cylinder (Cylinder tool). I selected the cylinder and used "Tools/Block Define" to make it a block named "test." I used the "Convert to block" option.

2. I opened another blank drawing "B" and drew a green cube (Box tool). I selected the cube and used "Tools/Block Define" to make it a block named "test." I used the "Convert to block" option.

3. The cube/block was selected and copied from drawing B to the clipboard.

4. I switched back to drawing A and pasted the cube/block into the drawing. It was still a green cube and the first block was still a red cylinder.

5. The Info Box revealed that the red cylinder was still a block named "test." The green cube was also still a block, but it was now named "test(1)."

6. I selected the green cube "test(1)" in drawing A and copied it to the clipboard.

7. Next I switched to drawing B and pasted the cube/block. The Info Box showed that both green cube/blocks were names "test."

****

I would say this all worked as it should except there were no warnings when the names of the pasted blocks were changed.

If you copy and paste a block from one drawing to another the pasted block will retain it's original block name if no other block with that name exists in the drawing, or if other identical blocks already exist in the drawing. The name will be changed if a block with the same name already exists in the drawing.

Phil




DesignCAD user since 1987

Lar

Quote from: Dr PR on December 17, 2012, 12:10:45 PM
... all you have to do is edit the original block.

Just a small point that you don't have to edit the original block. You can explode any of the blocks and edit it, or edit something entirely different. What changes the blocks is when you 'block define' using an existing block name. Then all the other blocks with that same name changes to match (dcad gives you a warning).

What I do to guard against mis-defining blocks is chose the 'retain' option when defining the block the first time. This causes the original entities to remain unblocked, so I have a backup.

If I copy and paste blocks between files I would have to explode one of the copies to have a backup in that file.

Lar

prl

#3
Quote from: Dr PR on December 20, 2012, 01:16:59 PM
I was curious about block behavior when they are transferred between drawings with copy/paste.

.
.
.

I would say this all worked as it should except there were no warnings when the names of the pasted blocks were changed.

There are some quirks.

Do your example again, specifically steps 1 to 5.  Now do the following steps.

6a.  Switch to drawing B.  Select the green cube (a block) and delete it.  Draw a blue pyramid. Select it, "block define", name it "test".  You'll get the warning as you should.  Finish the command.  Now select the blue pyramid block and as before copy it to the clipboard.

7a.  Switch to drawing A and paste.

Not what you expected?????




Dr PR

prl,

Thanks! This is the sort of thing I have been trying to figure out.

For those who didn't do the exercise, when I copy/pasted the third block (blue pyramid) from drawing B into drawing A what I got was another green cube!

****

I am trying to decide if it is safe to use blocks in my drawings. For the ship I am working on I have dozens of 3D drawings of the different parts of the ship. For example, there are five or six drawings of the superstructure. All use the same doors, hatches, exterior lights, air ports, gas bottles, etc. A well created door may be half a megabyte, and there are dozens of them on the ship (50-70 Mbytes of doors). If I create the doors in a master "Door.dc3" drawing and block each one, then when I add the doors to another drawing it won't bloat the file size as much. But if I change the block in the master drawing and copy/paste to a working drawing all existing blocks by that name will not be changed. That is a problem.

****

So why not use "symbols?" I have worked with many programs that use symbols, and they are a real pain to work with. In DesignCAD each symbol is a separate file. If you edit the symbol file all drawings that use that symbol will automatically be changed - if the program can find the edited symbol file. Move the working file to another machine (I use three) that doesn't have the edited symbol file and the change isn't made - you end up with two different drawings with the same name, even though you didn't actually change the drawings!

Worse still, you end up with a plethora of symbol files and NO way to view the symbols except to open each individual file. This is a real problem when you use someone else's symbols with names like "HJKSYUIDTR." It may mean something to someone, but it is gibberish to me (this is a major problem with many circuit design programs). For symbols to be useful you need a symbol viewer function, and DesignCAD doesn't have one.

****

I currently create master files for different types of objects, like doors, hatches, fire fighting equipment, electrical boxes, etc. Every time I need a new object I create it in the appropriate master file. After that I can copy/paste from the master file into my working files. All I have to do is open the appropriate master file and ALL of the objects in that file are visible. I don't need to know a cryptic symbol name - I just select the object I want, copy and paste into my working drawing.

Of course, if I change an object in the master file the change doesn't propogate to other drawings. I was hoping that if I made each object in a master file a block, and then copy/pasted it into a working drawing, all blocks with the same name would be changed to match the master block. As we see above, that doesn't work. In fact, it sometimes works backwards!

Oh well, back to the drawing board.

Phil


DesignCAD user since 1987

prl

#5
Quote from: Dr PR on December 20, 2012, 05:35:17 PM
I am trying to decide if it is safe to use blocks in my drawings.

Good summary.  I too am in the process of trying to figure out what is safe and reliable (and repeatable).  Whether it be blocks, embedded symbols, or external symbols.  Really don't want to go down a road  and get the old gotcha!

By the way, since you are probably building a list of pluses and minuses of blocks and such, the failure of the copy/paste example I gave is part of a more serious and general DesignCAD cache problem.  It affects all the load commands (symbol load, file merge, block load from a file, etc.)  Affects OLE and BasicCAD routines too.  Been griping about this one for ages.


Quote from: Dr PR on December 20, 2012, 05:35:17 PM
Every time I need a new object I create it in the appropriate master file. After that I can copy/paste from the master file into my working files. All I have to do is open the appropriate master file and ALL of the objects in that file are visible. I don't need to know a cryptic symbol name - I just select the object I want, copy and paste into my working drawing.

Following your current approach of using a master parts drawing (a showroom drawing) where you cut and paste to a working drawing, what if you paste off to the side in your working drawing (just like you are doing with normal entities - no blocks or symbols) and then do a "block define"  or more correctly a "block redefine" in the working drawing only?  This will give you the warning message but that is what you want.   If this sequence and methodology were to be standard for you, an OLE or basicCAD routine comes to mind.


minstrel

Quote from: prl on December 20, 2012, 06:23:53 PM
Following your current approach of using a master drawing where you cut and paste to a working drawing...

Blocks are the perfect solution!

My approach for 'block' exchanges or updates [for large projects] would go something like this:

1. Master file [which, for me,  is always the most up-to-date/current version]
2. BackUp/Copy file(s) - Prior to any new session work [or as you will] the 'Master' is saved here with identifier [version/revision or date].
3. Scratch file(s) - Global 'warehouse' for common design elements [blocks, text, graphics, etc.]

For best performance/efficency it requires a 2 monitor setup.

Working with the 'Master' file opened in one monitor; the 'Scratch' file opened in the other. 
How?  By opening the 'Scratch' file with another instance or previous version of 'DesignCAD'.

Now, the 'Scratch' file can contain the 'blocks' [original plus unlimited revisions]
each named as required [the name given is simply a placeholder].

From here it's just a matter of copy/paste of the 'block' from screen to screen, then redefine it using the original 'blocks' name....all similiar named blocks in the active drawing are replaced/updated.

Phil, this is pretty much what you are doing except the 'block' must manually be redefined/named...that's the extra step.

Now, it this process could be repeated in a 'Macro' that could open....well, that's another story.

Minstrel

prl

Phil,

Not sure if you want me to pollute your thread here with current "negatives" of blocks use. I could go into the issues of cutting and slicing your model if it has blocks, extraction of solids from blocks ("unblocking"), layers and blocks,  and for me what happens when you export a model with blocks.

You can start another topic if you want and I'll join in.

Assuming your interest in using blocks is about the good, the bad, and the ugly  (I always hear the music  . . . .)

prl

Quote from: minstrel on December 21, 2012, 02:10:46 AM
Now, it this process could be repeated in a 'Macro' that could open....well, that's another story.

Not the two instances of DesignCAD.  Two open drawings in one instance of DesignCAD, yes.

minstrel

#9
Quote from: prl on December 21, 2012, 03:08:27 AM
Not the two instances of DesignCAD.  Two open drawings in one instance of DesignCAD, yes.

Hah!...I take it you are not working with 2 monitors? or doing 'ScreenCasts'? or just enjoy jumping between windows....?

Seriously, one's workflow is as 'variable' as 'personality'....we can each choose who we want to be friends with ;)
I just freely offer...

Now, if we are talking about building a nice Macro?  I am looking forward to what you can come up with!

Minstrel

prl

Quote from: minstrel on December 21, 2012, 03:27:01 AM
Hah!...I take it you are not working with 2 monitors? or doing 'ScreenCasts'? or just enjoy jumping between windows....?

I use two monitors.  Can't work without them.

I was referring to the the ability of BasicCAD and dealing with two DC instances.  Can't do that.  You would need a separate macro in each instance.  One for going to the clipboard.  The other pasting from the clipboard.

JJG

Quote from: prl on December 21, 2012, 03:39:13 AM
I use two monitors.  Can't work without them.
Yes, me too !

just a tip :
[aside_mode on]
it happens to me from time to time to launch the keyboard shortcut "Ctrl W", assuming that the active window is DesignCAD, while this is an explorer which is active on the second screen.
In this case, Windows closes the Explorer in progress, but it also has an impact on DesignCAD : alphanumeric order of macros (if you open the window "Run Basicad") is changed, ie the . bsc are listed first, then. d3m, whereas normally all. bsc and. d3m are classified together.

Does this happen to you too?

The remedy I found is the following one : in an Explorer opened on the second screen, click on the name of a folder or a file, and then press "Ctrl W" again.
So, in DesignCAD, macros alphanumeric order is restored.
[aside_mode off]

prl

Quote from: JJG on December 21, 2012, 04:22:51 AM
[aside_mode on]
it happens to me from time to time to launch the keyboard shortcut "Ctrl W", assuming that the active window is DesignCAD, while this is an explorer which is active on the second screen.
In this case, Windows closes the Explorer in progress, but it also has an impact on DesignCAD : alphanumeric order of macros (if you open the window "Run Basicad") is changed, ie the . bsc are listed first, then. d3m, whereas normally all. bsc and. d3m are classified together.

Does this happen to you too?
[aside_mode off]

JJG, haven't run into that one.  My normal setup is DesignCAD maximized on the second screen (large screen) and all other programs (e-mail, explorer, Delphi, PsPad for basiccad, SketchUP, etc. on the primary screen).

I do, however, have some Windows layout hotkeys that will take my favorite programs and toss them back and forth on each screen remembering their proper positions, sizes and floating tool bars locations.  A must since my primary screen/computer is a 17" laptop that is often in the field and the office.

Dr PR

You have confirmed what I was thinking of doing.

1. Create new objects and edit existing objects in a "showroom" file containing similar objects (doors, hatches, etc.). These will not be converted to blocks in the "showroom" drawing.

2. Copy an object from my "showroom" file to the clipboard.

3. Paste the object into my working drawing.

4. Define the pasted object to be a block. If it is an update for blocks already in the drawing use the appropriate name. This will cause all existing blocks with that name to be replaced by the new block.

I will need to be very rigorous in maintaining handles in the correct positions so the replacement blocks end up in the correct places.

****

This will not automatically change every instance of the modified object in every drawing the way a symbol would do, but it doesn't require a bunch of symbol files to be carried with the working drawing.

It does allow me to open an older drawing, paste in an updated object, and replace all instances in that drawing. After that no external drawings are needed.

****

I think I will create a new layer in each working drawing and title it "blocks." When I paste objects into the drawing that are to be defined as blocks they will go into this layer. Then, when they are defined to be blocks I will use the "Retain" option to keep the original in the block layer. This will serve as a visible reminder of what blocks are in use in the drawing.

There are two reasons for keeping the original:

1. So I can tweak it in the working drawing if I need to, and later copy/paste it back into the "showroom" drawing.

2. So I can duplicate it and then modify it to create a new object. This can then be copy/pasted into the "showroom" drawing.

****

Can anyone see a problem with this method?

Phil
DesignCAD user since 1987

minstrel

Quote from: Dr PR on December 21, 2012, 10:50:45 PM
... These will not be converted to blocks in the "showroom" drawing.

Why not?  This is yet another wonderful benefit of 'blocks' - the can be assigned names and retain those names when copied into you current drawing.  Plus, this allows for better organization/control and quick seek/find capability in conjunction with any layers strategies you may already have in place.

Let's say you have an original block named 'box' in your 'Showroom' file.  In the process of time you have modified that block several times and have named each accordingly [ ex.  box_full of cash_euro, box_full of cash_monoply, etc -or simply - box_1a, box_1b, etc.]. 

As mentioned, these are just 'placeholder' names and may or may not have a thing to do with the current drawing your are working in.  So when they are copied and pasted into the current project they can be 'retained' [keeping their original 'placeholder' name for reference] as well as used to modify any existing block in the drawing.  Very powerful stuff here!

Another plus of converting your "Showroom" files immediately into blocks involves the handle. I normally make sure it's set to 'center'[gravity] then adjust, if necessary, when it's entered into the new drawing.

I also do any modification of the block [when possible] while it's within the "Showroom" file prior to the 'copy/paste' procedure into the new file.  This way it is immediately named and added to the Showroom file....and it is also why, in this situtation, I work with two instances of DesignCAD running simultaneously.

Minstrel