PICTools Programmer's Reference
CAD
This page provides information about the following:

CAD: OP_CAD

The OP_CAD structure supplies parameters to the OP_CAD2D opcode used to convert CAD drawing files to DIBs.

 
Copy Code
typedef struct {
   DWORD                         Reserved0;
   CAD_LAYOUT PICHUGE*           Layouts;
   CAD_LAYERS PICHUGE*           Layers;
   BYTE PICHUGE*                 Reserved3;
   BYTE PICHUGE*                 Reserved4;
   BYTE PICHUGE*                 Reserverd5;
   BYTE PICHUGE*                 Reserved6;
   BYTE PICHUGE*                 Reserved7;
   BYTE PICHUGE*                 Reserved8;
   PICFLAGS                      PicFlags;
   PICFLAGS                      PicFlags2;
   LONG                          FileType;
   DWORD                         FileVersion;
   DWORD                         NumLayouts;
   DWORD                         NumLayers;
   DWORD                         StripSize;
   DWORD                         WidthPad;
   DWORD                         Units;
   DWORD                         RenderWidth;
   DWORD                         RenderHeight;
   DWORD                         RenderBitDepth;
   RGBQUAD                       BackgroundColor;
   DWORD                         LayoutToRender;
} CAD;

Fields:

Name Description

Reserved0

This field is not currently used and must be set to 0.

Layouts

This points to an array of information about each of the layouts contained in the input drawing.  Each element in the array is a CAD_LAYOUT structure.  (See the CAD_LAYOUT section of this document for a description of this structure.)  The field NumLayouts indicates the number of entries in the array.  All fields in the CAD_LAYOUT structure are read-only fields for the application.

The memory for this array is allocated and freed by the opcode.  This is provided to the caller on return from the REQ_INIT phase. It is freed by the opcode and no longer available when REQ_TERM is called, or if RES_ERR is returned

Layers

This points to an array of information about each of the layers contained in the input drawing.  Each element in the array is a CAD_LAYER structure.  (See the CAD_LAYER section of this document for a description of this structure.)  The field NumLayers indicates the number of entries in the array. 

The CAD_LAYER.OFF field indicates whether the corresponding layer will be included in the output DIB.  It is initially set to the value contained in the input drawing.  Layers may be excluded from the output DIB by setting the CAD_LAYER.OFF field to a value of TRUE for each layer to be excluded. Layers may be included by setting the CAD_LAYER.OFF field to FALSE. All other CAD_LAYER fields are read-only fields for the application. 

The memory for this array is allocated and freed by the opcode.  This is provided to the caller on return from the REQ_INIT phase.  It is freed by the opcode and no longer available when REQ_TERM is called, or if RES_ERR is returned.

Reserved3

Reserved4

Reserved5

Reserved6

Reserved7

Reserved8

These fields are not currently used and must be set to 0.

PicFlags

Flags that control the Pegasus operations.

Value

Meaning

PF_NoDibPad

Set if Pegasus is not to pad the output DIB to a DWORD boundary

PF_WidthPadKnown

Set if the padded length of one DIB pixel line has been set by the application.  Otherwise the length is computed by Pegasus, padded to a 4-byte boundary.

PF_ExpandThumbnail

Set in order to return a bitmap representation of the thumbnail preview embedded in a CAD file.

PicFlags2

This field is not currently used.

FileType

Indicates the type of the input file contained in the Get queue. (See pic.h for the possible file types.)  This is provided to the caller on return from the REQ_INIT phase.

FileVersion

Indicates the version of the input file contained in the Get queue. (See pic.h for the possible file types.)  This is provided to the caller on return from the REQ_INIT phase.

NumLayouts

Indicates the number of layout entries in the field Layouts. This is provided to the caller on return from the REQ_INIT phase.

NumLayers

Indicates the number of layer entries in the field Layers. This is provided to the caller on return from the REQ_INIT phase.

StripSize

Specifies the minimum buffer size needed to hold one strip of output data. This is provided to the caller after REQ_EXEC has been invoked. The Put queue must be at least large enough to hold this number of bytes. If Q_REVERSE is set in the Put queue, then the Put queue size must be an integer multiple of StripSize.

WidthPad

Specifies the width of an uncompressed DIB pixel line in bytes.; WidthPad takes into account the number of bits needed to represent a pixel and any padding that may be required at the end of each line. WidthPad will be output by Pegasus unless the PF_WidthPadKnown flag is set in PicFlags. If PF_WidthPadKnown is set, then WidthPad must be input by the application. If PF_NoDIBPad is set, then the WidthPad computed by Pegasus will not include any padding necessary to align the DIB to a 4-byte boundary.

Units

The units specified in the input drawing. The dimensions of each layout contained in the Layouts field are in the units specified by this field. (See pic.h for the list of possible units). This is provided to the caller on return from the REQ_INIT phase.

RenderWidth

The desired width, in pixels, of the output DIB. This must be set by the client application prior to the REQ_EXEC phase.

RenderHeight

The desired height, in pixels, of the output DIB. This must be set by the client application prior to the REQ_EXEC phase.

RenderBitDepth

The desired bitdepth, in bits per pixel, of the output DIB. The default is 8bpp. Allowable values are 1, 4, 8,  24, and 32 bpp.

BackgroundColor

This field is used by the application to specify the desired background color of the output DIB.  The default value for this field is white (255, 255, 255).

LayoutToRender

This field is used by the application to specify the desired layout to render to the output DIB. The value for this field is an index into the Layouts array.The default value for this field is the index of the active layout contained in the input drawing.  To render the Model Space Layout, set this field to the value RENDER_MODEL_SPACE (see pic.h for definition).

CAD: CAD_LAYOUT

An instance of the CAD_LAYOUT structure exists for each layout in a CAD file that contains viewable entities.  Some layouts may exist which contain no viewable entities.  These layouts are not returned by the opcode. 

 
Copy Code
typedef struct {
   CHAR        Name[CAD_MAX_STRING];
   double      Width;
   double      Height;
   DWORD       Reserved[8];
} CAD_LAYOUT;

Fields:

Name Description

Name

The name of the layout.

Width

The width of the layout in the units associated with the drawing, as indicated by the Units field of the CAD structure.

Height

The height of the layout in the units associated with the drawing, as indicated by the Units field of the CAD structure.

Reserved

Not used, reserved for future use.

CAD: CAD_LAYER

An instance of the CAD_LAYER structure exists for each layer in a CAD file. 

 
Copy Code
typedef struct {
   CHAR        Name[CAD_MAX_STRING];
   CHAR        Desc[CAD_MAX_STRING];
   DWORD       Frozen;
   DWORD       InUse;
   DWORD       Locked;
   DWORD       Plottable;
   DWORD       Off;
   DWORD       Reserved[8];
} CAD_LAYER;

Fields:

Name Description

Name

The name of the layer.

Desc

The first CAD_MAX_STRING characters of the textual description of the layer.

Frozen

A value of 1 indicates the layer is frozen.

InUse

A value of 1 indicates the layer is in use.

Locked

A value of 1 indicates the layer is locked.

Plottable

A value of 1 indicates the layer is plottable.

Off

A value of 1 indicates the layer is not visible. The client may set this to include or exclude the layer from the output. It is initially set by the opcode to the value specified in the input drawing.

Reserved

Not used, reserved for future use.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback