protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed) { base.setJSON(obj, host, processed); string contextIdentifier = ContextIdentifier; if (!string.IsNullOrEmpty(contextIdentifier)) { obj["ContextIdentifier"] = contextIdentifier; } string contextType = ContextType; if (!string.IsNullOrEmpty(contextType)) { obj["ContextType"] = contextType; } JArray reps = new JArray(); foreach (IfcRepresentation r in RepresentationsInContext) { if (!processed.Contains(r.Index)) { reps.Add(r.getJson(this, processed)); } } if (reps.Count > 0) { obj["RepresentationsInContext"] = reps; } DatabaseIfc db = new DatabaseIfc(ModelView.Ifc4NotAssigned); db.Factory.Options.GenerateOwnerHistory = false; IfcProject project = new IfcProject(db, "MyProjectNumber"); project.UnitsInContext = new IfcUnitAssignment(db).SetUnits(IfcUnitAssignment.Length.Inch); IfcPolyline line = new IfcPolyline(new IfcCartesianPoint(db, 0, 0, 0), new IfcCartesianPoint(db, 10, 0, 0)); new IfcPresentationLayerAssignment("Default", line) { }; IfcShapeRepresentation sr = new IfcShapeRepresentation(line); }
internal static IfcPolyline Parse(string strDef) { IfcPolyline p = new IfcPolyline(); int ipos = 0; parseFields(p, ParserSTEP.SplitLineFields(strDef), ref ipos); return p; }
internal IfcPolyline(IfcPolyline pl) : base(pl) { mPoints = new List<int>(pl.mPoints.ToArray()); }
internal static void parseFields(IfcPolyline p, List<string> arrFields, ref int ipos) { IfcBoundedCurve.parseFields(p, arrFields, ref ipos); p.mPoints = ParserSTEP.SplitListLinks(arrFields[ipos++]); }
protected IfcElement(IfcProduct host, IfcMaterialProfileSetUsage profile, IfcAxis2Placement3D placement, double length) : base(host,new IfcLocalPlacement(host.Placement,placement), null) { List<IfcShapeModel> reps = new List<IfcShapeModel>(); IfcCartesianPoint cp = new IfcCartesianPoint(mDatabase, 0, 0, length); IfcPolyline ipl = new IfcPolyline(mDatabase.Factory.Origin, cp); reps.Add(IfcShapeRepresentation.GetAxisRep(ipl)); profile.Associates.addAssociation(this); IfcMaterialProfileSet ps = profile.ForProfileSet; IfcMaterialProfileSetUsageTapering psut = profile as IfcMaterialProfileSetUsageTapering; if (psut != null) throw new Exception("Tapering Elements not implemented yet!"); IfcProfileDef pd = null; if (ps.mCompositeProfile > 0) pd = ps.CompositeProfile; else { if (ps.mMaterialProfiles.Count > 0) pd = ps.MaterialProfiles[0].Profile; else throw new Exception("Profile not provided"); } if (pd != null) reps.Add(new IfcShapeRepresentation( new IfcExtrudedAreaSolid(pd, pd.CalculateTransform(profile.CardinalPoint), length))); Representation = new IfcProductDefinitionShape(reps); }