Hide Table of Contents

Extracting BlockAttributes to a Text File

The ExtractBlockAttribute command lets you extract BlockAttribute values to text files of various formats.

Template files define the data to extract.

You can examine the extracted data using spreadsheet software or other applications.

To extract BlockAttributes to a text file:

  1. Type ExtractBlockAttribute at the command prompt.
  2. In the dialog box, for Template, type a template name to define the data to extract. Click  to browse for a file.

    See Creating Template Files for BlockAttribute Extractions for information about the file syntax.

  3. Click Select Entities to specify the entities for extracting BlockAttribute data.

    The dialog box closes temporarily.

  4. In the graphics area, select Blocks with BlockAttributes and press Enter.
  5. In the dialog box, for Output, type the location and name of the output file. Click  to select a file name.
  6. In Format, select the file format to use when writing the BlockAttributes information:
    • Comma Delimited File (CDF). Commas separate the fields of each BlockAttribute record. Strings are enclosed by single quotation marks.
    • Space Delimited File (SDF). Spaces separate the fields of each BlockAttribute record. Strings are enclosed by single quotation marks.
  7. Click OK.

Creating Template Files for BlockAttribute Extractions

Template files for BlockAttribute extractions define the data fields to extract and control the format in which they appear.

Use an ASCII text editor to create a template file for BlockAttribute Extractions.

Each line in the template file:

  • Specifies the BlockAttributes and the Block properties to extract.
  • Must use a specific syntax described below.
  • Becomes a column in the resulting output file (see example).

You must include at least one BlockAttribute name in a template file.

File Syntax

Each line in the template file uses the following syntax:

field_name [space(s)] output_format

Valid field names are shown in the Extraction Field Names table below.

One or more spaces separate field_name and output_format. Use spaces, no tabs. End each line by pressing Enter, including the last line.

The output format uses the following syntax:

Twwwppp

The data type (T) can be:

C Indicates a character string field.
N Indicates a numeric field.

The next two portions of the output format use three digits:

www Width Specifies the width of the field as a number of characters.
ppp Precision Specifies the number of decimal places for numeric fields.
For character integer fields, specify 000.

For example,

  • Use N006002 for a numeric value up to 999.99. N stands for numeric data, 006 means that there is space for up to six digits, including the decimal point, and 002 specifies the precision of two decimal places.
  • Use C025000 for a string field with a maximum length of 25 characters. Always specify 000 as the last three format digits for character fields.

Table: Extraction Field Names

You can extract:

  • The value of BlockAttributes of Blocks inserted into the drawing.
  • Predefined properties of the Block to which the BlockAttribute belongs.

Use the following extraction field names and format specifications to extract relevant data:

Field Name Format Extracts
BlockAttribute name Cwww000, or Nwwwppp BlockAttribute value
BL:NAME Cwww000 Block name
BL:X Nwwwppp X coordinate of Block insertion point
BL:Y Nwwwppp Y coordinate of Block insertion point
BL:Z Nwwwppp Z coordinate of Block insertion point
BL:ORIENT Nwwwppp Block rotation angle
BL:XSCALE Nwwwppp X scale factor for Block
BL:YSCALE Nwwwppp Y scale factor for Block
BL:ZSCALE Nwwwppp Z scale factor for Block
BL:XEXTRUDE Nwwwppp Block extrusion in X direction
BL:YEXTRUDE Nwwwppp Block extrusion in Y direction
BL:ZEXTRUDE Nwwwppp Block extrusion in Z direction
BL:LAYER Cwww000 Block insertion Layer name
BL:HANDLE Cwww000 Block handle
BL:NUMBER Nwww000 Block counter
BL:LEVEL Nwww000 Block nesting level

Example

Template file:

BUILDINGTYPE C030000
ZONENAME     C025000
ACTIVITY     C020000
HVACSYSTEM   C025000
AREA         N006002
HEIGHT       N004002
BL:NAME      C012000
BL:NUMBER    N002000

Output file (.cdf format):

'Workshops/maintenance depot','Z0/09 Staff Room','Eating/drinking area','Underfloor Heating',31.79,2.55,'ZONE',1
'Workshops/maintenance depot','Z0/14 Plant Room','Plant room','Zone without HVAC system',15.84,4.10,'ZONE',2
'Warehouse and storage','ZO/11 Lobby','Storage area','Space Heating',53.26,4.10,'ZONE',3
...

Access

Command: ExtractBlockAttribute



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Extracting BlockAttributes to a Text File
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: 2023 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.