internal static IfcShapeRepresentation ShapeRepresentationCreate(IfcStore model, string repType, string repId) { IfcShapeRepresentation shape = model.Instances.New <IfcShapeRepresentation>(); IfcGeometricRepresentationContext modelContext = model.Instances.OfType <IfcGeometricRepresentationContext>().FirstOrDefault(); shape.ContextOfItems = modelContext; shape.RepresentationType = repType; shape.RepresentationIdentifier = repId; return(shape); }
public GeometricRepresentationContext(IfcStore model, string contextType, long coordinateSpaceDim, double precision, PlacementAxis3D worldCoordinateSystem) { this.contextType = contextType; this.coordinateSpaceDimension = coordinateSpaceDim; this.precision = precision; this.worldCoordinateSystem = worldCoordinateSystem; this.Model = model; ifcRepresenationContext = Model.Instances.New <IfcGeometricRepresentationContext>(r => { r.ContextType = contextType; r.CoordinateSpaceDimension = coordinateSpaceDim; r.Precision = precision; r.WorldCoordinateSystem = worldCoordinateSystem.IfcAxis2Placement3D; }); }
private void InitialiseGeometry() { var modelInstances = TargetRepository.Instances; _origin3D = modelInstances.New <IfcCartesianPoint>(c => c.SetXYZ(0, 0, 0)); _origin2D = modelInstances.New <IfcCartesianPoint>(c => c.SetXY(0, 0)); _downDirection = modelInstances.New <IfcDirection>(d => d.SetXYZ(0, 0, -1)); var mainContext = TargetRepository.IfcProject.ModelContext(); mainContext.ContextIdentifier = null; //balnk of the main context _model3DContext = modelInstances.New <IfcGeometricRepresentationSubContext>(c => { c.ContextType = "Model"; c.ContextIdentifier = "Body"; c.ParentContext = TargetRepository.IfcProject.ModelContext(); c.TargetView = IfcGeometricProjectionEnum.MODEL_VIEW; } ); }
public void SetContext() { SetBbDirection3D(); Origin2D = BbCoordinate2D.Create(); SetBbDirection2D(); GeometricRepresentationContext = new IfcGeometricRepresentationContext { ContextType = "Model", CoordinateSpaceDimension = 3, Precision = 1E-08, WorldCoordinateSystem = new IfcAxis2Placement { Value = DefaultBbPosition3D.IfcAxis2Placement3D } }; }
/// <summary> /// Sets up the default units as SI /// Creates the GeometricRepresentationContext for a Model view, required by Ifc compliance /// </summary> /// <param name = "ifcProject"></param> public static void Initialize(this IfcProject ifcProject, ProjectUnits units) { IModel model = ifcProject.ModelOf; if (units == ProjectUnits.SIUnitsUK) { IfcUnitAssignment ua = model.Instances.New <IfcUnitAssignment>(); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.LENGTHUNIT; s.Name = IfcSIUnitName.METRE; s.Prefix = IfcSIPrefix.MILLI; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.AREAUNIT; s.Name = IfcSIUnitName.SQUARE_METRE; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.VOLUMEUNIT; s.Name = IfcSIUnitName.CUBIC_METRE; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.SOLIDANGLEUNIT; s.Name = IfcSIUnitName.STERADIAN; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.PLANEANGLEUNIT; s.Name = IfcSIUnitName.RADIAN; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.MASSUNIT; s.Name = IfcSIUnitName.GRAM; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.TIMEUNIT; s.Name = IfcSIUnitName.SECOND; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT; s.Name = IfcSIUnitName.DEGREE_CELSIUS; })); ua.Units.Add(model.Instances.New <IfcSIUnit>(s => { s.UnitType = IfcUnitEnum.LUMINOUSINTENSITYUNIT; s.Name = IfcSIUnitName.LUMEN; })); ifcProject.UnitsInContext = ua; } //Create the Mandatory Model View if (ModelContext(ifcProject) == null) { IfcCartesianPoint origin = model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(0, 0, 0)); IfcAxis2Placement3D axis3D = model.Instances.New <IfcAxis2Placement3D>(a => a.Location = origin); IfcGeometricRepresentationContext gc = model.Instances.New <IfcGeometricRepresentationContext>(c => { c. ContextType = "Model"; c. ContextIdentifier = "Building Model"; c. CoordinateSpaceDimension = 3; c.Precision = 0.00001; c. WorldCoordinateSystem = axis3D; } ); ifcProject.RepresentationContexts.Add(gc); IfcCartesianPoint origin2D = model.Instances.New <IfcCartesianPoint>(p => p.SetXY(0, 0)); IfcAxis2Placement2D axis2D = model.Instances.New <IfcAxis2Placement2D>(a => a.Location = origin2D); IfcGeometricRepresentationContext pc = model.Instances.New <IfcGeometricRepresentationContext>(c => { c. ContextType = "Plan"; c. ContextIdentifier = "Building Plan View"; c. CoordinateSpaceDimension = 2; c.Precision = 0.00001; c. WorldCoordinateSystem = axis2D; } ); ifcProject.RepresentationContexts.Add(pc); } }
public void SetContext() { SetBbDirection3D(); Origin2D = BbCoordinate2D.Create(); SetBbDirection2D(); GeometricRepresentationContext = new IfcGeometricRepresentationContext { ContextType = "Model", CoordinateSpaceDimension = 3, Precision = 1E-08, WorldCoordinateSystem = new IfcAxis2Placement { Value = DefaultBbPosition3D.IfcAxis2Placement3D } }; }
public void RetrieveContext(IfcGeometricRepresentationContext ifcGeometricRepresentationContext) { GeometricRepresentationContext = ifcGeometricRepresentationContext; }
public IfcShapeRepresentation NewGeometricRepresentation(IfcProduct product, IfcGeometricRepresentationItem representationItem, IfcStyleAssignmentSelect style = null, string representationContext = "Model", string representationContextId = "Body") { if (Store != product.Model || Store != representationItem.Model) { throw new ArgumentException("Model mismatch"); } IfcShapeRepresentation shapeRepresentation = null; Wrap(s => { var productDefinitionShape = product.Representation; if (null == productDefinitionShape) { productDefinitionShape = s.Instances.New <IfcProductDefinitionShape>(); } if (null != style) { s.Instances.New <IfcStyledItem>(i => { i.Item = representationItem; i.Styles.Add(style); }); } product.Representation = productDefinitionShape; shapeRepresentation = s.Instances.New <IfcShapeRepresentation>(); productDefinitionShape.Representations.Add(shapeRepresentation); var project = Scopes.OfType <IfcProject>().FirstOrDefault(); var contexts = project .RepresentationContexts .Where <IfcGeometricRepresentationContext>(c => c.ContextType == representationContext); IfcGeometricRepresentationContext context = null; if (contexts.Count() > 1) { context = contexts.Where(c => c.ContextIdentifier == representationContextId).FirstOrDefault(); } else { context = contexts.FirstOrDefault(); } if (null == context) { context = Store.NewIfc4GeometricContext(representationContextId, representationContext); } shapeRepresentation.ContextOfItems = context; shapeRepresentation.Items.Add(representationItem); }); return(shapeRepresentation); }
public static IfcShapeRepresentation NewIfc4ShapeRepresentation(this IModel s, IfcProduct product, IfcGeometricRepresentationContext context = null) { var productDefinitionShape = product.Representation; if (null == productDefinitionShape) { productDefinitionShape = s.Instances.New <IfcProductDefinitionShape>(); } product.Representation = productDefinitionShape; var shapeRepresentation = s.Instances.New <IfcShapeRepresentation>(); productDefinitionShape.Representations.Add(shapeRepresentation); var project = s.Instances.OfType <IfcProject>().FirstOrDefault(); shapeRepresentation.ContextOfItems = context ?? project.ModelContext; return(shapeRepresentation); }
public void RetrieveContext(IfcGeometricRepresentationContext ifcGeometricRepresentationContext) { GeometricRepresentationContext = ifcGeometricRepresentationContext; }