Box From Table
Create solid boxes and insert blocks based on data from an Excel table. For those who love Excel programming.
The BoxFromTable program is intended for those who do not know how to program AutoCAD/BricsCAD, but know any programming languages or are well versed in Excel formulas. You can create a table describing the model of any simple product (for example, rectangular furniture). You simply describe in numbers where and what kind of solid boxes to create. Then the BoxFromTable program will build a model using this data, arrange blocks of fasteners, drill holes, and create a block assembly.
Program features:
Works with Excel files, text files (CSV, TSV), JSON.
The table can be taken from any sheet in an Excel workbook.
Column separators in text files can be selected: comma, semicolon, tab.
Creates solids in the form of boxes, cylinders, cones, pyramids, spheres at a given point.
Rotates solids in three axes.
Assigns properties to objects: color, layer, material, name, kind, info.
If non-existent layers or materials are specified, the program will look for them in the drawing template or automatically create new ones.
Inserts blocks (previously created) into the drawing.
Drills holes in solids using the Drill command.
Creates new blocks or named groups. For blocks, use the Create Assembly (AsmCreate) command. And these blocks can immediately be inserted into the model at specified points.
Can invoke the Expose Asseblies command on created blocks.
The command is not yet sold as a separate plugin, but is supplied only as a set in the AVC Pro collection.
The program can be supplemented according to your orders. You can create a command to access your web server instead of a table.
Operating procedure
Before calling the BoxFromTable command, create an Excel or CSV table with columns:
A Shape: solid shape: Box, Cone, Cylinder, Pyramid, Sphere, Block. Another word is the line is ignored.
B X-coordinate of insertion of the minimum point of the box or the center of the base of other shapes.
C Y.
D Z.
E SizeX: dimensions of the solid along the X axis. For a block, this is the scale along the X axis. A scale less than zero is a mirror block.
F SizeY.
G SizeZ.
H RotateX: rotation of a solid or block around the X axis relative to the insertion point. degrees,
I RotateY.
J RotateZ.
K Layer: layer.
L Color: name of the color. Look in the AVC Properties Palette to see how indexed or RGB colors are described in text.
M Material: material. Can change the solid color if the AVC Properties Palette is configured to assign color by material.
N Owner: name of the group or new assembly block for this part. To insert into model space, specify Model.
O Name: The name for the part or the name of an existing block to insert.
P Kind: grade/type/kind of part. Not used for blocks.
Q Info: description of the part. Not used for blocks.
Columns A-J must be completed. Columns K-Q may be missing (starting from the Layer).
Instead of creating a solid, you can insert an existing block into the drawing. Then the columns mean:
Shape = Block.
SizeX, SizeY, SizeZ - block insertion scale. Preferably 1. Less than zero - mirror block.
Owner - the name of the old block where the specified block or Model should be inserted
Name - the name of an existing block to insert or the name of a block from a dwt template.
Headings are not needed, but you can add them. If the program comes across lines with an unknown word in the first column, such lines will be ignored. Rows with merged cells and collapsed rows will also not be taken into account.
The Excel table will be read from the sheet specified in the settings. And if not specified - from the first sheet.
Reading lines will continue until the first line with an empty first column.
In CSV text files, use the column separator you specified in the settings. Default is comma. If you need to use this sign inside a column, place \ in front of it.
The decimal separator in numbers should be the same one that is displayed in your AVC Properties Palette. But it can be configured in Common Options. The default is dot.
If you want to pass objects serialized as JSON to the program, then it must be an array of objects with the same property names as indicated above. Look in the project on GitHub for the BoxData.cs file. It describes the structure of such a class in C#. You'll need to do something similar in your favorite programming language.
After creating the table file, you will still need to configure the BoxFromTable command. Settings on the Box From Table tab in the AVC Options Palette (AVCOptions).
Call the BoxFromTable command.
If a file request is configured, the program will open a file selection dialog. But you can configure the opening of the same file without prompting.
Next, the program will create solids and blocks in the model. Perhaps you will have time to notice them at the origin. Then the program will create blocks from them and delete the original constructions.
If necessary, the drilling program is called and will subtract all the solids of the Holes layer, including those inside the blocks.
If nothing is written in the Owner column, then blocks or groups will be created using the assembly name template from the AsmCreate command settings.
Next, blocks with Owner = Model will be inserted into the drawing. Including freshly created blocks.
You can disable block creation and enable groups. The program will simply combine the created objects into co-selection groups. In this case, the attempt will fail - the program only inserts blocks.
At the end of the work, the program can call the Expose Assemblies command.
Options
Program settings should be made before calling the BoxFromTable command. All settings are located on the BoxFromTable tab in the AVC Options Palette.
The operation of the program can also be affected by the settings of the Drilling, Assembly Creation, and Expose Assemblies programs.