Navigation: Scripting Reference Manual > Functions & Subroutines > DoCADImport

 

DoCADImport

 

Contact Us: fredsupport@photonengr.com

 

Description

This command executes a CAD import into the document associated with the script and returns the node number of the subassembly containing the imported geometry.

 

 

Syntax

subNode = DoCadImport( tCad )

 

 

Parameters

subNode (Long)

Node number of the subassembly containing the newly imported CAD geometry.  All imported surfaces and curves are created as descendants of this node.

 

tCad As T_CADIMPORT

T_CADIMPORT data structure whose member values define the import conditions.

 

 

Example

The following example initializes a T_CADIMPORT structure in preparation for importing a CAD file, imports the geometry, assigns reflective characteristics to the constituent surfaces and re-positions the new geometry at a known position.

 

Sub Main

 

    'Import reflector from STEP file

    Dim tCadImport As T_CADIMPORT

    Dim subNode As Long

    InitCADImport tCadImport

        tCadImport.filename = GetDocDir() & "\cadReflector.stp"

        tCadImport.localSurfOrigin = "average (u,v)"

        tCadImport.surfDrawMode = "wire"

    subNode = DoCADImport( tCadImport )

    Print "Imported object parent node at " & subNode

 

    'Set coating and raytrace control to all surfaces in the subassembly

    SetAllCoatingProp( subNode, FindCoating("Reflect") )

    SetAllRaytraceControlProp( subNode, FindRaytraceCtrl("Reflect Specular") )

 

    'Position reflector at a known location

    Dim op As T_OPERATION

    op.Type = "ShiftZ"

    op.parent = 2 'geometry

    op.val1 = -5

    AddOperation subNode, op

    Update

 

End Sub

 

 

See Also

Import/Export Script Commands

T_CADIMPORT

 

 

 

 

 

Copyright © Photon Engineering, LLC