new IFCPanel( [config] [, typeName])
Creates a new IFC panel component.
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object |
<optional> |
An optional configuration object. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties of
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Name | Type | Argument | Description |
|---|---|---|---|
layout |
number |
<optional> |
The panel layout or arrangement, defaults to zero. |
frameLeft |
number |
<optional> |
The width of the frame stile on the inner/hinge-side in mm, defaults to 4" or 100mm. |
frameRight |
number |
<optional> |
The width of the frame stile on the outer/lock-side in mm, defaults to 4" or 100mm. |
frameBottom |
number |
<optional> |
The height of the bottom rail in mm, defaults to 8" or 200mm. |
frameTop |
number |
<optional> |
The height of the top rail in mm, defaults to 4" or 100mm. |
mullionWidth |
number |
<optional> |
The width of any internal vertical mullions in mm, defaults to 4" or 100mm. |
mullionDepth |
number |
<optional> |
The thickness of any internal vertical mullions as a fraction or in mm, defaults to 1.0 which is the panel depth. |
mullionOffset |
number |
<optional> |
The relative offset of the major vertical mullion, defaults to 0.5. |
transomHeight |
number |
<optional> |
The height of any internal horizontal transoms in mm, defaults to 4" or 100mm. |
transomDepth |
number |
<optional> |
The thickness of any internal horizontal transoms as a fraction or in mm, defaults to 1.0 which is the panel depth. |
transomOffset |
number |
<optional> |
The relative offset of the major horizontal transom, defaults to 0.5. |
subPanelDepth |
number |
<optional> |
The thickness of any solid sub-panels as a fraction or in mm, defaults to 0.25. |
subPanelCallback |
function |
<optional> |
An optional callback triggered when each sub-panel is added. |
typeNameAn additional parameter typically used by subclasses to set the
component type name without modifying the config object.
Extends
Members
-
:string
className <readonly>
-
The name of the subclass for this object instance.
This name must match the name of this class within the
PD.Registry. Thus, the base implementation simply referencesthis.constructor.getClassName()to ensure that this is always the case even for subclasses. As a result, there is rarely any need to override this method.This property is used when copying, storing and exporting data for subclass instances to ensure that they are recreated as instances of the right class.
Type
- string
- Inherited From:
- Overrides:
-
:string
description
-
A brief product or type description, defaults to an empty string.
This description is typically used to provide additional information about the product to other team members, such as its reasons for selection. important features, specifications and/or intended use.
Type
- string
- Inherited From:
- Overrides:
-
:string
displayName <readonly>
-
The name to display for this class within the user interface.
Type
- string
- Inherited From:
- Overrides:
-
:number
frameBottom
-
The height of the bottom rail in mm, defaults to 8" or 200mm.
Type
- number
-
:number
frameLeft
-
The width of the frame stile on the inner/hinge-side in mm, defaults to 4" or 100mm.
Type
- number
-
:number
frameRight
-
The width of the frame stile on the outer/lock-side in mm, defaults to 4" or 100mm
Type
- number
-
:number
frameTop
-
The height of the top rail in mm, defaults to 4" or 100mm.
Type
- number
-
:string
iconName <readonly>
-
The name of the SVG icon to associate with this object instance.
This name should match the name of the icon associated with this class within the
PD.Registry. Thus, the default implementation simply referencesthis.constructor.getClassName()to ensure that this is always the case, even for subclasses. However, you can override this property if you want a different icon dependant on other properties of the class instance, as shown in the example below.Type
- string
- Inherited From:
- Overrides:
Example
// Overriding the icon name. MyElements.Table = class extends PD.Base { /// ... get iconName() { if (this.hasRoundTop) return 'MyElements.Table.Round'; return this.constructor.getClassName(); }; /// ... }; -
:boolean
isComponent <readonly>
-
A flag identifying this object as a shared BIM component.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
isIFCPanel <readonly>
-
A flag identifying this object as an IFC panel component.
Type
- boolean
-
:boolean
isLocked
-
Whether or not this component's parameters are fixed.
This property is used by the UI and framework to indicate that the component's parameters are fixed and therefore not editable. It is typically set by a 3rd-party manufacturer or supplier on products that they can only provide in one configuration.
For example, there is no point specifying a particular manufacturer's fridge and then adjusting its width to fit a hole in your cabinetry if that manufacturer cannot actually supply a fridge of that width.
Thus, when this property is
true, you will not be able to edit the parameters, but you can always duplicate the component (or its configuration), but without the supplier details if you really do want to modify it.Type
- boolean
- Inherited From:
- Overrides:
-
:BIM.PANEL
layout
-
The panel layout or arrangement, defaults to zero.
Type
-
:number
mullionDepth
-
The thickness of any internal vertical mullions as a fraction or in mm, defaults to 1.0 which is the panel depth.
Type
- number
-
:number
mullionOffset
-
The relative offset of the major vertical mullion, defaults to 0.5.
Type
- number
-
:number
mullionWidth
-
The width of any internal vertical mullions in mm, defaults to 4" or 100mm.
Type
- number
-
:string
name
-
A human-readable name for this item instance.
Type
- string
- Inherited From:
- Overrides:
-
:string
productRef
-
The product reference number or identifier, defaults to an empty string.
The product reference is typically used to store a serial number, model number, SKU or other identifier provided by the manufacturer or supplier to uniquely identify this product.
Type
- string
- Inherited From:
- Overrides:
-
:function|null
subPanelCallback
-
An optional callback triggered when each sub-panel is added.
Type
- function | null
-
:number
subPanelDepth
-
The thickness of any solid sub-panels as a fraction or in mm, defaults to 0.25.
Type
- number
-
:number
subType <readonly>
-
An element-specific subtype.
Type
- number
- Inherited From:
- Overrides:
-
:string
supplier
-
The product supplier/manufacturer, defaults to
null.This property contains details of the supplier or manufacturer of this product or component. Multiple components can share the same supplier instance to avoid unnecessary duplication of data.
Type
- string
- Inherited From:
- Overrides:
-
:number
transomDepth
-
The thickness of any internal horizontal transoms as a fraction or in mm, defaults to 1.0 which is the panel depth.
Type
- number
-
:number
transomHeight
-
The height of any internal horizontal transoms in mm, defaults to 4" or 100mm.
Type
- number
-
:number
transomOffset
-
The relative offset of the major horizontal transom, defaults to 0.5.
Type
- number
-
:string
uuid
-
A universally unique identifier for the item instance.
Type
- string
- Inherited From:
- Overrides:
-
:object
DoorFrameMetal <static>
-
Stores the configuration of a metal frame panel.
Type
- object
-
:object
WindowFramesMetal <static>
-
Stores the configuration of a metal window frame.
Type
- object
-
:object
WindowFramesTimber <static>
-
Stores the configuration of a timber window frame.
Type
- object
Methods
-
adaptAndFitPanelData(panelData)
-
Adapts the shared panel data to fit the given panel size.
The same panel layout can be used to generate panels of any size or aspect ratio, such as different sized doors or window casements. Rather than modify the original values, a shared object is used to store a volatile copy of the panel layout data that ia adapted to fit the given size.
As this is a shared data object, you must use it immediately and only within the same method that computing it. This method will be called for every door that uses swinging, sliding or folding panels, so you cannot assume that the data won't change between if you try to use it at some stage without resetting.
Parameters:
Name Type Description panelDataobject The shared panel description data object.
Returns:
Returns the shared panel description data object.
- Type
- object
-
addHandleToShell(panelData, aperture, handle, coords [, side])
-
Adds the geometry of a handle to the panel ready for visualisation.
This method uses the panel data to position the handle, then adds the handle surfaces to the given aperture's shell.
Parameters:
Name Type Argument Description panelDataobject The shared panel description object.
apertureBIM.Aperture The aperture element being rebuilt.
handleBIM.Handles The outer handle to add to the panel frame.
coordsPD.LocalCoordinates The local coordinate system to use.
sidePD.SIDE <optional>
The side to add the handle to, defaults to
PD.SIDE.MIDDLEfor both sides.Returns:
Returns an array of facets for the handle added to the shell.
- Type
- Array
-
addMullionsAndTransoms(panelData, aperture, coords, facets, panel_groups)
-
Inserts sub-panels between separate mullions and transoms.
Parameters:
Name Type Description panelDataobject The shared panel description object.
apertureBIM.Aperture The aperture element being rebuilt.
coordsPD.LocalCoordinates The local coordinate system to use.
facetsArray The list of facets in the monolithic panel.
panel_groupsArray The columns and rows of sub-panels.
Returns:
Returns the array monolithic panel facets.
- Type
- Array
-
addSubPanelsToMonolith(panelData, aperture, coords, facets, panel_groups)
-
Inserts sub-panels as holes within the outer monolithic slab panel.
Parameters:
Name Type Description panelDataobject The shared panel description object.
apertureBIM.Aperture The aperture element being rebuilt.
coordsPD.LocalCoordinates The local coordinate system to use.
facetsArray The list of facets in the monolithic panel.
panel_groupsArray The columns and rows of sub-panels.
Returns:
Returns the array monolithic panel facets.
- Type
- Array
-
addToShell(panelData, aperture, coords)
-
Generates a panel in the aperture shell with an optional sub-panel layout.
Parameters:
Name Type Description panelDataobject The shared panel description object.
apertureBIM.Aperture The aperture element being rebuilt.
coordsPD.LocalCoordinates The local coordinate system to use.
Returns:
Returns an array of 10 facets.
- Type
- Array
-
checkDynamicParameter(param, group, host)
-
Checks the allowable range of aperture parameter values.
See the
PD.Base#checkDynamicParametermethod for more details.Parameters:
Name Type Description paramPD.Parameter The parameter that is being interactively changed.
groupPD.ParamGroup The group that the dynamic parameter belongs to.
hostBIM.Entity The parent aperture type component.
- Inherited From:
- Overrides:
Example
checkDynamicParameter(param, group, host) { switch (param.name) { case 'height': if (param.value < 1.0) param.value = 1.0; break; case 'width': case 'length': if (param.value < 100.0) param.value = 100.0; if (this.standardBedSize > 0) { // If not custom. group.setParameterValue('standardBedSize', 0); this.standardBedSize = 0; // Make it custom. } break; case 'standardBedSize': { const std_bed = this.getStandardBedSize(Math.round(param.value)); if (std_bed != null) { const [ width, length ] = (PD.DIMENSION.useImperial) ? std_bed.sizeImperial : std_bed.sizeMetric; this.width = PD.Utils.toNumber(width, this.width); group.setParameterValue('width', this.width); this.length = PD.Utils.toNumber(length, this.length); group.setParameterValue('length', this.length); } } break; } }; -
clone()
-
Creates a copy of this instance with different name and uuid.
- Inherited From:
- Overrides:
Returns:
Returns a new instance with copied values.
- Type
- PD.Base | null
-
fromJSON(data)
-
Safely copy properties from a source object.
See the
PD.Base#fromJSONmethod for more details.Parameters:
Name Type Description dataobject The source object containing data to copy.
- Overrides:
Returns:
Returns this instance to support method chaining.
- Type
- BIM.IFCPanel
-
generatePlanSection(panelData, aperture, coords)
-
Generates a plan-section view of the panel layout.
Parameters:
Name Type Description panelDataobject The adapted panel dimensions.
apertureBIM.Aperture The aperture to add geometry to.
coordsPD.LocalCoordinates The local coordinate system to use.
-
getDynamicParameters(host [, title])
-
Provides a dynamic parameter group for adjusting this panel layout.
See the
PD.Base#getDynamicParametersmethod for more details.Parameters:
Name Type Argument Description hostBIM.Entity The host aperture type component.
titlestring <optional>
An optional title for the parameter group.
- Inherited From:
- Overrides:
Returns:
Returns a
PD.ParamGroupfor the panel.- Type
- PD.ParamGroup
Example
getDynamicParameters(host) { return [ new PD.ParamGroup({ name: 'mainParams', title: 'Table Parameters', target: this, params: [ new PD.Parameter({ name: 'height', title: 'Table Height', value: this.height, paramType: PD.ParamType.SmallDistance, description: 'The height from floor level to the top of the table.' }), new PD.Parameter({ name: 'size', title: 'Table Top Size/Diameter', value: this.size, paramType: PD.ParamType.Distance, description: 'The size of the table top when not defined by a closed path.' }), new PD.Parameter({ name: 'thickness', title: 'Table Top Thickness', value: this.thickness, paramType: PD.ParamType.SmallDistance, description: 'The thickness of the table top surface.' }), new PD.Parameter({ name: 'offset', title: 'Offset From Path', value: this.offset, paramType: PD.ParamType.SmallDistance, description: 'The offset distance from the table path.' }), new PD.Parameter({ name: 'swapSides', title: 'Swap Sides', value: this.swapSides, paramType: PD.ParamType.Boolean, description: 'Reverse the direction of the table relative to its path.' }), new PD.Parameter({ name: 'isRound', title: 'Round Table', value: this.isRound, paramType: PD.ParamType.Boolean, description: 'Whether or not the table surface is round.' }), ] }), new PD.ParamGroup({ name: 'legParams', title: 'Leg Parameters', target: this, params: [ new PD.Parameter({ name: 'legCount', title: 'Number of Legs', value: this.legCount, paramType: PD.ParamType.Integer, description: 'The number of legs on the table.' }), new PD.Parameter({ name: 'legSize', title: 'Leg Size', value: this.legSize, paramType: PD.ParamType.SmallDistance, description: 'The thickness of each leg of the table.' }), new PD.Parameter({ name: 'legInset', title: 'Leg Edge Inset', value: this.legInset, paramType: PD.ParamType.SmallDistance, description: 'The inset distance of each leg from the table edge.' }), new PD.Parameter({ name: 'legOffset', title: 'Leg Edge Offset', value: this.legOffset, paramType: PD.ParamType.Fraction, description: 'The relative distance of the leg along each edge span.' }), new PD.Parameter({ name: 'legSpan', title: 'Max. Distance Between Legs', value: this.legSpan, paramType: PD.ParamType.Distance, description: 'The maximum distance between legs along each edge span.' }) ] }) ]; }; -
getNameAndSupplierParameters()
-
Provides a list of dynamic parameter groups for the component name, description and supplier.
See the
PD.Base#getDynamicParametersmethod for more details.- Inherited From:
- Overrides:
Returns:
Returns an array of
PD.ParamGroupobjects.- Type
- Array
-
getSubPanelCount()
-
Retrieves the current number of sub-panel openings in the panel.
Returns:
Returns the number of sub-panels.
- Type
- number
-
hasMethod(component, methodName)
-
Determines if this component has a callable method with the given name.
This method is useful for checking if the component has a particular method before attempting to call it, thereby avoiding potential runtime errors. It is used within the framework to check for the presence of life-cycle methods in an element's type component before delegating them.
Parameters:
Name Type Description componentBIM.Component The component to check.
methodNamestring The case-sensitive name of the function/method to check for.
- Inherited From:
- Overrides:
Returns:
Returns true if the component is valid and has the function name as a method, otherwise false.
- Type
- boolean
-
isCompatibleWith(obj)
-
Determines if this component can be added to the given entity.
Whilst a small number of components may be compatible with multiple entity types, most components are designed to be used only by a specific entity type, and will not allow you to assign them to an incompatible entity.
Parameters:
Name Type Description objBIM.ENTITY | BIM.Entity The entity type or object instance to check for compatibility with.
- Inherited From:
- Overrides:
Returns:
Returns true if the component can be added to the object, otherwise false.
- Type
- boolean
-
rebuild(element)
-
Rebuilds the geometry of this component ready for visualisation.
This is a placeholder method that should be overridden by subclasses to provide the necessary geometry generation logic for the component. Geometry is typically added to the host element's
brepand/orshellbased on itspath.Parameters:
Name Type Description elementBIM.Element The element to rebuild.
- Inherited From:
- Overrides:
Returns:
Returns this component instance to support method chaining.
- Type
- BIM.Component
-
renderPanelInPlanSection(panelData, aperture, meshes, coords [, outline] [, no_infill])
-
Generates a plan-section view of the panel layout.
Parameters:
Name Type Argument Default Description panelDataobject The adapted panel dimensions.
apertureBIM.Aperture The aperture to render.
meshesBIM.Meshes The set of meshes to add geometry to.
coordsPD.LocalCoordinates The local coordinate system to use.
outlineboolean <optional>
false Don't draw in section when true.
no_infillboolean <optional>
false Don't draw panel infill when true.
-
updateDynamicParameters(param, group)
-
Sets the dynamic parameter value and returns true if it changed.
Most subclasses don't need to override this method as it automatically detects changes and rebuilds the element/component and model when required. However, if you do need to add your own custom logic or intercept the return value, please read the following examples carefully and use whichever best suits your needs.
NOTE: When overriding this method, you may not want to call
super.updateDynamicParameters(param, group)as the parent class may have added its own logic that may interfere with what you want to do. Instead, either use the staticPD.Base.updateDynamicParametersOnHostmethod to check if the value changed, or base it on the third example which replicates the code in that static method.Parameters:
Name Type Description paramPD.Parameter The dynamic parameter that changed.
groupPD.ParamGroup The group that the dynamic parameter belongs to.
- Inherited From:
- Overrides:
Returns:
Returns true if the value actually changed.
- Type
- boolean
Examples
updateDynamicParameters(param, group) { /// When you want parent class to use its logic. if (super.updateDynamicParameters(param, group)) { if (param.name == 'i_am_special') this.doSomethingSpecial(); return true; } return false; };updateDynamicParameters(param, group) { /// When you don't want parent to handle parameter updates. if (PD.Base.updateDynamicParametersOnHost(param, group, this)) { /// Invalidate geometry. if (this.typeComponent) { ++this.typeComponent.updateIndex; } /// Rebuild element. this.hasChanged = true; this.update(); /// Only update site mesh. if (this.onlyUsesSiteMesh) { const level = this.level; if (level) { // Don't trigger whole level update. level.rebuildSiteMesh(); PD.GlobalActions.redrawAndUpdateSelection(); return false; } } return true; } return false; };updateDynamicParameters(param, group) { /// The following three lines of code replicate /// `PD.Base.updateDynamicParametersOnHost()`, which you can /// use if you need to access `target` without having to call /// `group.getTarget() || this` twice. const target = group.getTarget() || this; target.checkDynamicParameter(param, group, this); if (param.setValueOnHostIfDifferent(target, group, this)) { /// You can now use `target`. if (target.myOwnMeshThatIsUpdatedDuringRebuild) { /// Rebuild element. this.hasChanged = true; this.update(); /// If no level meshes or other elements are affected, /// simply update the target locally and return false. this.myOwnMeshThatIsUpdatedDuringRebuild.update(); /// Update selection meshes if the /// element's highlight geometry changed. PD.GlobalActions.updateSelectionMeshes(); return false; } return true; } return false; }; -
getAndResetSharedPanelData() <static>
-
Retrieves a shared data object describing a panel configuration.
The same panel type instance can be used to generate window and door panels for many different apertures, each one with potentially different sizes and aspect ratios. Moreover, a single door aperture may have multiple swinging, folding or sliding panels, each at different angles and orientations. Some of these may be too small to accommodate the current frame, mullion and transom sizes, which then need to be reduced to fit the actual panel size.
Rather than modifying actual instance properties, this shared data object stores a temporary copy of all the data required to describe such a panel, which can then be dynamically adapted to fit a specific panel size. Also, as apertures can be dynamically resized at up to 60 times per second, a shared object is used to avoid unnecessary memory allocation and minimise garbage collection issues.
The data stored by this shared object should be considered highly volatile. Thus you should retrieve it, set its values and then use it, all within the same function or method. The obvious intention is that this object be passed around to other classes or functions during that process, but that should occur within the same higher level method, as shown in the example below.
Returns:
Returns a shared panel description object.
- Type
- object
Example
function generateDoorPanel(level, aperture) { if (aperture.panelComponent) { const frame_type = aperture.typeComponent; const panel_type = aperture.panelComponent; /// Retrieve and initialise panel data. const panel = BIM.IFCPanel.getAndResetSharedPanelData(); panel.open = Math.max(0.0, aperture.openFraction); panel.width = aperture.width - (2 * frame_type.frameWidth); panel.depth = Math.max(1.0, frame_type.panelDepth); panel.height = aperture.height - frame_type.frameHeight; panel.section = level.sectionHeight; panel.direction = PD.FORWARD; panel.back2back = false; panel.flip = false; /// Set up local coordinate to align with junction. const coords = aperture.computeSharedLocalCoordinates(); /// Single swinging door panel. panel.angle = panel.open * 90.0; if (aperture.swapDirection) { panel.flip = !panel.flip; panel.angle = -panel.angle; coords.moveOrigin(aperture.width, 0.0); coords.xAxis.negate(); } if (aperture.swapSides) { panel.flip = !panel.flip; panel.angle = -panel.angle; coords.yAxis.negate(); } /// Move to start of panel. coords.moveOrigin(frame_type.frameWidth, frame_type.frameOffset); aperture.panelComponent.addToShell(panel, aperture, coords); if (aperture.handleComponent) { coords.moveOrigin( panel.width - Math.max(50, frame_type.frameWidth * 0.5), 0.0, Math.min(900, panel.height * 0.5) ); aperture.handleComponent.addToShell(coords, aperture.shell, PD.Utils.sign(panel.depth), !panel.flip)); } } } -
getClassDescription() <static>
-
A brief description of this class to accompany its icon.
Returns:
Returns a brief description.
- Type
- string
-
getClassName() <static>
-
The name of this class within the
PD.Registry.See
PD.Base.getClassNamefor more details as this is required for use with thePD.Registry.Returns:
Returns the registered name of this class.
- Type
- string
-
getDisplayName() <static>
-
The name to display within the user interface.
Returns:
Returns the display name.
- Type
- string
-
subType() <static>
-
Retrieves the sub-type of this class represents.
See
BIM.Component#subTypefor more details on this static method.Returns:
Returns the sub-type enumerator of this class.
- Type
- BIM.PANEL