public Buildable Convert(DbElement element) { Size size = new Size(); Position position = new Position(); Direction direction = new Direction(); size.Height = element.GetDouble(DbAttributeInstance.HEIG); size.Diameter = element.GetDouble(DbAttributeInstance.DIAM); var q = new DbQualifier(); q.Add(1); q.wrtQualifier = element.OwnerInHierarchyOfType(DbElementTypeInstance.EQUIPMENT); var pos = element.GetPosition(DbAttributeInstance.PPOS, q); position.X = pos.X; position.Y = pos.Y; position.Z = pos.Z; var d = element.GetDirection(DbAttributeInstance.PDIR, q); direction.X = d.ToString(); direction.Y = d.ToString(); direction.Z = d.ToString(); return(new Buildable(DbElementTypeInstance.SCYLINDER, element, size, position, direction, element.ElementType)); }
public Buildable Convert(DbElement element) { Size size = new Size(); Position position = new Position(); Direction direction = new Direction(); size.XLength = element.GetDouble(DbAttributeInstance.XLEN); size.YLength = element.GetDouble(DbAttributeInstance.YLEN); size.ZLength = element.GetDouble(DbAttributeInstance.ZLEN); var q = new DbQualifier(); q.Add(6); q.wrtQualifier = element.OwnerInHierarchyOfType(DbElementTypeInstance.EQUIPMENT); var pos = element.GetPosition(DbAttributeInstance.PPOS, q); position.X = pos.X; position.Y = pos.Y; position.Z = pos.Z; var orientation = element.GetOrientation(DbAttributeInstance.ORI, q); direction.X = orientation.XDir().ToString(); direction.Y = orientation.YDir().ToString(); direction.Z = orientation.ZDir().ToString(); return(new Buildable(DbElementTypeInstance.LPYRAMID, element, size, position, direction, element.ElementType)); }
public Buildable Convert(DbElement element) { Size size = new Size(); Position position = new Position(); Direction direction = new Direction(); size.TopDiameter = element.GetDouble(DbAttributeInstance.DTOP); size.BotDiameter = element.GetDouble(DbAttributeInstance.DBOT); size.Height = element.GetDouble(DbAttributeInstance.HEIG); var q = new DbQualifier(); q.Add(1); q.wrtQualifier = element.OwnerInHierarchyOfType(DbElementTypeInstance.EQUIPMENT); var pos = element.GetPosition(DbAttributeInstance.PPOS, q); position.X = pos.X; position.Y = pos.Y; position.Z = pos.Z; var orientation = element.GetOrientation(DbAttributeInstance.ORI, q); direction.X = orientation.XDir().ToString(); direction.Y = orientation.YDir().ToString(); direction.Z = orientation.ZDir().ToString(); return(new Buildable(DbElementTypeInstance.LSNOUT, element, size, position, direction, element.ElementType)); }
public Buildable Convert(DbElement element) { Size size = new Size(); Position position = new Position(); Direction direction = new Direction(); size.Diameter = element.GetDouble(DbAttributeInstance.ROUT) - element.GetDouble(DbAttributeInstance.RINS); var q = new DbQualifier(); q.Add(1); q.wrtQualifier = element.OwnerInHierarchyOfType(DbElementTypeInstance.EQUIPMENT); var pos = element.GetPosition(DbAttributeInstance.PPOS, q); position.X = pos.X; position.Y = pos.Y; position.Z = pos.Z; var d = element.GetDirection(DbAttributeInstance.PDIR, q); direction.X = d.ToString(); direction.Y = d.ToString(); direction.Z = d.ToString(); //TODO: fix mess q = new DbQualifier(); q.Add(2); q.wrtQualifier = element.OwnerInHierarchyOfType(DbElementTypeInstance.EQUIPMENT); Position position2 = new Position(); Direction direction2 = new Direction(); pos = element.GetPosition(DbAttributeInstance.PPOS, q); position2.X = pos.X; position2.Y = pos.Y; position2.Z = pos.Z; d = element.GetDirection(DbAttributeInstance.PDIR, q); direction2.X = d.ToString(); direction2.Y = d.ToString(); direction2.Z = d.ToString(); return(new Buildable(DbElementTypeInstance.SCTORUS, element, size, position, direction, position2, direction2)); }
public Buildable Convert(DbElement element) { Size size = new Size(); Position position = new Position(); Direction direction = new Direction(); var q = new DbQualifier(); q.Add(1); q.wrtQualifier = element.OwnerInHierarchyOfType(DbElementTypeInstance.EQUIPMENT); var nozzleConfig = new NozzleConfig(); size.Diameter = element.GetDouble(DbAttributeInstance.PPBO, q); var description = element.GetString(DbAttributeInstance.DESC); if (string.IsNullOrWhiteSpace(description)) { nozzleConfig.Coco = element.GetString(DbAttributeInstance.PPCO, q); } else { nozzleConfig.Coco = description; } var pos = element.GetPosition(DbAttributeInstance.PPOS, q); position.X = pos.X; position.Y = pos.Y; position.Z = pos.Z; var d = element.GetDirection(DbAttributeInstance.PDIR, q); direction.X = d.ToString(); direction.Y = d.ToString(); direction.Z = d.ToString(); //TODO: handle multiple BLRFARRAYS var catref = DbElement.GetElement(); if (element.GetValidRef(DbAttributeInstance.CATR, ref catref)) { var catrefOfCatref = DbElement.GetElement(); if (catref.GetValidRef(DbAttributeInstance.CATR, ref catrefOfCatref)) { DbElement[] blrfarray = new DbElement[5]; if (catrefOfCatref.GetValidRefArray(DbAttributeInstance.BLRF, ref blrfarray)) { nozzleConfig.Blrfarray = blrfarray; } var attributes = catrefOfCatref.GetAttributes(); foreach (DbAttribute item in attributes) { Console.WriteLine(item.Description); } nozzleConfig.Parameters = catrefOfCatref.GetDoubleArray(DbAttributeInstance.PARA); var dataset = DbElement.GetElement(); if (catrefOfCatref.GetValidRef(DbAttributeInstance.DTRE, ref dataset)) { nozzleConfig.Dataset = dataset; } //if (!dataset.IsValid) { // var flanScom = MDB.CurrentMDB.FindElement("/EMFWBR0-40-0"); // if (flanScom.GetValidRef(DbAttributeInstance.DTRE, ref dataset)) { // Console.WriteLine(dataset); // nozzleConfig.Dataset = dataset; // } //} } } var name = element.Name().ToUpper(); if (name.Contains("ARRIVE")) { nozzleConfig.Ppoint = 1; } else if (name.Contains("LEAVE")) { nozzleConfig.Ppoint = 2; } else if (name.Contains("P#")) { if (int.TryParse(name.Split('#').Last(), out int p)) { nozzleConfig.Ppoint = p; } } return(new Buildable(DbElementTypeInstance.NOZZLE, element, size, position, direction, nozzleConfig)); }