DataExtenions - RickdeM/HicadCommunity GitHub Wiki
Create/Update a Attribute value or delete it Due to some incorrect object casting with default methond 'SetValue' this extension method overrides some default object types
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Create/Update the attribute U_ATTR
n.AttributeSet.SetObjectValue("U_ATTR", "VALUE");Get the linked feature of the edge
Returns ISD.CAD.Data.Feature
Example
// Select an edge
Edge e = ISD.CAD.Interface.Selection.SelectEdge("Select Edge");
// Get the feature which created the edge
Feature featNode = e.GetLinkedFeature();Get the linked feature ID of the edge
Returns string
Example
// Select an edge
Edge e = ISD.CAD.Interface.Selection.SelectEdge("Select Edge");
// Get the feature ID which created the edge
int featNodeID = e.GetLinkedFeatureID();Get the linked protocol Node of the edge (Node where the feature is stored)
Returns ISD.CAD.Data.Node
Example
// Select an edge
Edge e = ISD.CAD.Interface.Selection.SelectEdge("Select Edge");
// Get the protocol node of the linked feature (Part where the feature is placed)
Node featProtocolNode = e.GetLinkedProtocolNode();Get the linked protocol Node UID of the edge (Where the feature is stored)
Returns string
Example
// Select an edge
Edge e = ISD.CAD.Interface.Selection.SelectEdge("Select Edge");
// Get the protocol node ID of the linked feature (Part where the feature is placed)
string featProtocolNodeID = e.GetLinkedProtocolNodeID();Get the linked feature of the facet
Returns ISD.CAD.Data.Feature
Example
// Select an Facet
Facet f = ISD.CAD.Interface.Selection.SelectFacet("Select Facet");
// Get the feature which created the facet
Feature featNode = f.GetLinkedFeature();Get the linked feature ID of the facet
Returns string
Example
// Select an Facet
Facet f = ISD.CAD.Interface.Selection.SelectFacet("Select Facet");
// Get the feature ID which created the facet
int featNodeID = f.GetLinkedFeatureID();Get the linked protocol Node of the facet (Node where the feature is stored)
Returns ISD.CAD.Data.Node
Example
// Select an Facet
Facet f = ISD.CAD.Interface.Selection.SelectFacet("Select Facet");
// Get the protocol node of the linked feature (Part where the feature is placed)
Node featProtocolNode = f.GetLinkedProtocolNode();Get the linked protocol Node UID of the facet (Where the feature is stored)
Returns string
Example
// Select an Facet
Facet f = ISD.CAD.Interface.Selection.SelectFacet("Select Facet");
// Get the protocol node ID of the linked feature (Part where the feature is placed)
string featProtocolNodeID = f.GetLinkedProtocolNodeID();Get all the edges of a Node
Returns System.Collections.Generic.List<ISD.CAD.Data.Edge>
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get all Edges of the Node
List<Edge> edge = n.GetEdges();Get all the Facets of a Node
Returns System.Collections.Generic.List<ISD.CAD.Data.Facet>
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get all Facets of the Node
List<Facet> faces = n.GetFacets();Get the material name from the Node
Returns string
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get the material name from the Node
string materialName = n.GetMaterialName();Get the material size from the Node
Returns double
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get the material size from the Node
double materialSize = n.GetMaterialSize();Get the Part beloning to the NodeNode
Returns ISD.CAD.Data.Part
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get the Part name from the Node (Higher level)
Part p = n.GetPart();Get a List of Nodes which are PartsListRelevant, scans the Node entire TreeNode and only considers 1 level.
Returns System.Collections.Generic.List<ISD.CAD.Data.Node>
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get the Product Structure from the Node
IEnumerable<Node> pds = n.GetProductStructure();Checks if the Node is Referenced
Returns bool
Example
// Get the active Node
Node n = Context.ActiveNode;
// Check if the Node is Referenced
bool isReferenced = n.IsReferenced();Checks if the Node is Referenced External (KRA)
Returns bool
Example
// Get the active Node
Node n = Context.ActiveNode;
// Check if the Node is Referenced External
bool isReferencedExt = n.IsReferencedExternal();Checks if the Node is Referenced Internal
Returns bool
Example
// Get the active Node
Node n = Context.ActiveNode;
// Check if the Node is Referenced Internal
bool isReferencedInt = n.IsReferencedInternal();Move (Transform) a Node
Parameters:
| Parameter | Type | Description |
|---|---|---|
| start | ISD.Math.Point3D | Start point |
| end | ISD.Math.Point3D | End point |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Move the Node 100 up
n.Move(new Point3D(0, 0, 0), new Point3D(0, 0, 100));Parameters:
| Parameter | Type | Description |
|---|---|---|
| vec | ISD.Math.Vector3D | Vector used for transformation |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Move the Node 100 up
n.Move(new Vector3D(new Point3D(0, 0, 0), new Point3D(0, 0, 100)));Parameters:
| Parameter | Type | Description |
|---|---|---|
| start | ISD.Math.WorkingPlane | Start WorkingPlane for transformation |
| end | ISD.Math.WorkingPlane | End WorkingPlane for transformation |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Select and create start/end WorkingPlane
WorkingPlane start = WorkingPlaneCreator.CreateInteractive();
WorkingPlane end = WorkingPlaneCreator.CreateInteractive();
// Move and rotate the part between the WorkingPlanes
n.Move(start,end);Parameters:
| Parameter | Type | Description |
|---|---|---|
| start | ISD.Math.CoordinateSystem | Start CoordinateSystem for transformation |
| end | ISD.Math.WorkingPlane | End WorkingPlane for transformation |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Get the active CoordinateSystem
CoordinateSystem start = Context.ActiveCoorSys;
// Select and create /end WorkingPlane
WorkingPlane end = WorkingPlaneCreator.CreateInteractive();
// Move and rotate the part between the WorkingPlanes
n.Move(start,end);Parameters:
| Parameter | Type | Description |
|---|---|---|
| start | ISD.Math.WorkingPlane | Start WorkingPlane for transformation |
| end | ISD.Math.CoordinateSystem | End CoordinateSystem for transformation |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Select and create /end WorkingPlane
WorkingPlane start = WorkingPlaneCreator.CreateInteractive();
// Get the active CoordinateSystem
CoordinateSystem end = Context.ActiveCoorSys;
// Move and rotate the part between the WorkingPlanes
n.Move(start,end);Parameters:
| Parameter | Type | Description |
|---|---|---|
| start | ISD.Math.CoordinateSystem | Start CoordinateSystem for transformation |
| end | ISD.Math.CoordinateSystem | End CoordinateSystem for transformation |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Select and create /end WorkingPlane
CoordinateSystem start = Context.ActiveCoorSys;
// Get the Global CoordinateSystem
CoordinateSystem end = CoordinateSystem.Global();
// Move and rotate the part between the WorkingPlanes
n.Move(start,end);Rotate (Transform) a Node
Parameters:
| Parameter | Type | default | Description |
|---|---|---|---|
| angle | ISD.BaseTypes.Angle | Angle in degrees | |
| vector* | ISD.Math.Vector3D | NormVector3D.E3 | Rotating vector (angle is CCW, rotates from X-axis to Y-axis), default axis is Z |
| point* | ISD.Math.Vector3D | New Point3D() | Rotating point, default Point is 0,0,0 |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Rotate the Node
n.Rotate(
20,
NormVector3D.E2,
new Point3D(10, 0, 0)
);Change the PartsListRelevant of the given Node
Parameters:
| Parameter | Type | Description |
|---|---|---|
| isRelevant | bool | Flag for BOM relevant or not |
Returns self
Example
// Get the active Node
Node n = Context.ActiveNode;
// Mark the Node as BOM relevant
n.SetPartsListRelevant(true);
// Mark the Node as BOM irrelevant
n.SetPartsListRelevant(false);Activate the Scene: Used for switching between drawing when External References are used
Parameters:
| Parameter | Type | Description |
|---|---|---|
| update | ISD.CAD.Contexts.Settings.UpdatePartReferences | How to handle the updating of external referenced parts |
Returns self
Example
// Get a Scene
Scene scene = Context.ActiveScene;
// Activate the Scene and automatically update all Newer references
scene.Activate(UpdatePartReferences.Newer);Import a DXF/DWG
DXF/DWG import settings are handled by acadhcad.dat files
Parameters:
| Parameter | Type | default | Description |
|---|---|---|---|
| file | string | The file which needs to be imported in the scene | |
| AutoMoveToZeroPoint* | bool | false | Automatically move the imported figure from BottomLeft to 0,0 |
| file* | bool | false | Make the figure scale independent |
| configurationFile* | string | null | Import configuration file, default is 'C:\HiCAD\sys\acadhcad.dat' |
Returns ISD.CAD.Data.Figure
Example
// Get the active Scene
Scene scene = Context.ActiveScene;
// Import a dxf File
Figure f = scene.ImportDxfDwg(@"c:\temp\example.dxf");Parameters:
| Parameter | Type | default | Description |
|---|---|---|---|
| file | FileInfo | The file which needs to be imported in the scene | |
| AutoMoveToZeroPoint* | bool | false | Automatically move the imported figure from BottomLeft to 0,0 |
| file* | bool | false | Make the figure scale independent |
| configurationFile* | string | null | Import configuration file, default is 'C:\HiCAD\sys\acadhcad.dat' |
Returns ISD.CAD.Data.Figure
Example
// Get the active Scene
Scene scene = Context.ActiveScene;
// Import a dxf File
Figure f = scene.ImportDxfDwg(new FileInfo(@"c:\temp\example.dxf"));Import a STP
STP import settings are handled by the CFGDB
Parameters:
| Parameter | Type | Description |
|---|---|---|
| file | string | The file which needs to be imported in the scene |
Returns ISD.CAD.Data.Node
Example
// Get the active Scene
Scene scene = Context.ActiveScene;
// Import a stp File
Node f = scene.ImportStp(@"c:\temp\example.stp");Parameters:
| Parameter | Type | Description |
|---|---|---|
| file | FileInfo | The file which needs to be imported in the scene |
Returns ISD.CAD.Data.Node
Example
// Get the active Scene
Scene scene = Context.ActiveScene;
// Import a stp File
Node f = scene.ImportStp(new FileInfo(@"c:\temp\example.stp"));Save the current drawing
Parameters:
| Parameter | Type | Description |
|---|---|---|
| save | ISD.CAD.Contexts.Settings.SavePartReferences | How to handle the saving of external referenced parts |
Returns self
Parse a product path to a local/network file/directory
Returns string
Example
string file = "Y:test.sza";
// Y path is by default C:\Hicad\Custom, See Hicad\exe\filegrup.dat for available paths
// Result would be C:\Hicad\Custom\test.sza
string realFile = file.ParseProductPath();Close all open drawings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| save | bool | Save the drawings before closing it |
| savePartReference | ISD.CAD.Contexts.Settings.SavePartReferences | How to handle the saving of external referenced parts |
Returns void
Example
Context.CloseAllDrawings(true, SavePartReferences.Modified);Creata a CoordinateSystem Orthonogal from 3 given points
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pointO | ISD.Math.Point3D | Origion Point |
| pointX | ISD.Math.Point3D | Point on the X-axis |
| pointY | ISD.Math.Point3D | Point on the Y-axis |
Returns ISD.CAD.Data.CoordinateSystem
Example
// Y
// ^
// O - - - > X
CoordinateSystem cs = Context.CreateCoordinateSystemOrthonogal(
new Point3D(0,0,0),
new Point3D(8,0,0),
new Point3D(4,2,0)
);Get the active SheetMetal node if present
Returns ISD.CAD.Data.Node
Example
Node n = Context.GetActiveSheetMetalNode();Get the active Cataloge directory
Returns string
Example
string catDir = Context.GetCatalogDirectory();Get the active CfgDB directory
Returns string
Example
string cfgDBDir = Context.GetCfgdbDirectory();Open a new slot with an existing drawing
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sceneName | string | FileName to open/create |
| readOnly | bool | When opening existing document, open in readonly mode |
| update | ISD.CAD.Contexts.Settings.UpdatePartReferences | How to handle the updating of external referenced parts |
Returns ISD.CAD.Data.Scene
Example
Scene s = Context.OpenNewSlot(@"C:\temp\test.sza", false, UpdatePartReferences.Newer);