Bcc.AddEntities
Bcc.AddEntities({EntityList})
Description
This function can be utilized add multiple CAD entities to the entity database in the form an entity list.
Parameters
The primary input of this function is a Table which can include the following keys:
- CmdName – The name that will be displayed in the Undo/Redo list – This can be excluded if using the Bcc.StartUndo() and Bcc.EndUndo()
- Type = "ChainList" - the input of the AddEntities function is a chain list
- List - a list of various chain types supported by the
- Color – the entity color can be specified using either the color name or the hexadecimal color value
- Color = “Red”
- Color = “#E400FF”
- Layer – The name of the layer to create the entity on
- Can be an existing layer or if does not exist the layer will be created
- if this is omitted the entity is created on the currently active layer in BobCAD
- LineStyle (or PointStyle) - the attribute of the entity to be solid, dashed, etc (or various point styles for the point entity). Please see the specific entity type for further information.
NOTE: The color, layer, linestyle, pointstyle defined in the individual entity will overwrite any attributes that are defined for the chain in this command
- TransformMatrix - A 4x4 matrix can be specified to transform the given entities coordinates
- TransformMatrix = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{10,10,0,0}}
Return
Returns the entity ID's in a list which were assigned by the BobCAD system for each created entity.
Returns nil if the function failed to create the entity with the given input parameters.
Examples
PointList
-- Create a point list which will draw all the point locations
Bcc.AddEntities({ CmdName="PointList", Type="Points", List={{10,10,0},{10,20,0},{10,30,0},{-10,10,0},{-10,20,0},{-10,30,0}}})
Polyline
-- Create a point list which will draw a chain of line entities
Bcc.AddEntities({ CmdName="Chain of Lines", Type="Polyline", List={{10,10,0},{10,20,0},{10,30,0},{-10,10,0},{-10,20,0},{-10,30,0}}})
ContourList
-- Create a shape utilizing a contour list which requires fully defined entities
function drawContourList()
scale = 25.4
line1 = { EntityType="Line", StartPoint={1*scale,0,0}, EndPoint={0.4330*scale,0.9821*scale,0} }
arc1 = { EntityType="ArcFromPoints", StartPoint={0.4330*scale,0.9821*scale,0}, EndPoint={-0.4330*scale,0.9821*scale,0}, Center={0,0.7321*scale,0}, IsClockwise=false }
line2 = { EntityType="Line", StartPoint={-0.4330*scale,0.9821*scale,0}, EndPoint={-1*scale,0,0}}
line3 = { EntityType="Line", StartPoint={-1*scale,0,0}, EndPoint={1*scale,0,0}}
retIDs = Bcc.AddEntities({ CmdName="Contour List", Type="ContourList", List={line1,arc1,line2,line3} })
end
ContourChain
-- Create a shape utilizing a contour chain which only requires end points from entity 2 thru n
function drawContourChain()
scale = 25.4
line1 = { EntityType="Line", StartPoint={1*scale,0,0}, EndPoint={0.4330*scale,0.9821*scale,0} }
arc1 = { EntityType="ArcFromPoints", EndPoint={-0.4330*scale,0.9821*scale,0}, Center={0,0.7321*scale,0}, IsClockwise=false }
line2 = { EntityType="Line", EndPoint={-1*scale,0,0} }
line3 = { EntityType="Line", EndPoint={1*scale,0,0} }
retIDs = Bcc.AddEntities({ CmdName="Contour List", Type="ContourChain", List={line1,arc1,line2,line3} })
end