Esempio n. 1
0
        /// <summary>
        /// 获取当前的文档对象
        /// </summary>
        /// <param name="projectData"></param>
        /// <param name="instance"></param>
        /// <param name="options"></param>
        /// <param name="fullFilePath"></param>
        /// <param name="cancel"></param>
        /// <returns></returns>
        private static ItDocument GetDocument(CNCProjectData projectData, AssemblyInstance instance, ICamExportIntOptions options, string fullFilePath, out bool cancel)
        {
            cancel = false;
            bool       flag = instance == null;
            ItDocument result;

            if (flag)
            {
                result = null;
            }
            else
            {
                bool flag2 = ItCNCFileWriter.dontOverwriteExistingFile(fullFilePath, options.OverwriteMode, out cancel);
                bool flag3 = flag2 | cancel;
                if (flag3)
                {
                    result = null;
                }
                else
                {
                    string     fileName      = Path.GetFileName(fullFilePath);
                    string     directoryName = Path.GetDirectoryName(fullFilePath);
                    ItDocument itDocument    = new ItDocument
                    {
                        productType = instance.productType(),
                        FilePath    = directoryName,
                        FileName    = fileName
                    };
                    itDocument.prepare(projectData);
                    result = itDocument;
                }
            }
            return(result);
        }
Esempio n. 2
0
        public void ExcuteForStructuralFramming(Document doc, AssemblyInstance assemblyInstance)
        {
            List <FamilyInstance> familyInstances = FIlterAllstructuralFramming(assemblyInstance);
            var symbol = Get3dsymbol(doc);
            XYZ tong   = XYZ.Zero;

            for (int i = 0; i < familyInstances.Count; i++)
            {
                var    value = familyInstances[i];
                XYZ    Center1;
                double Volumns1;
                GetCenterPoinSkintSolids(Solidhelper.AllSolids(value), out Center1, out Volumns1);
                tong = tong + Center1;
            }
            XYZ Center = tong / familyInstances.Count;

            if (symbol != null)
            {
                PlaceSymbol(doc, symbol, Center, familyInstances.First());
            }
            else
            {
                DrawingModelline(doc, Center);
            }
        }
Esempio n. 3
0
        // Token: 0x06000071 RID: 113 RVA: 0x000053D0 File Offset: 0x000035D0
        private bool ExportShellToUnitechnik(AssemblyInstance assemblyInstance, int iProdNo, CNCProjectData projectData, ItMachineDataWallDB.DbwElementData.Shell shell, int doubleWallGapInMM)
        {
            ItGeMatrix3d matWcsToPalette = base.MatWcsToPalette;

            base.MatWcsToPalette = shell.Transformation;
            this.Mode            = shell.Mode;
            bool flag = base.ExportUnitechnik(assemblyInstance, new RevitElement <Part>[]
            {
                shell.Part
            }, iProdNo, projectData);

            ItUniWrapperImpl.SetDoubleWallGap(doubleWallGapInMM);
            bool flag2 = !flag;
            bool result;

            if (flag2)
            {
                result = flag;
            }
            else
            {
                base.MatWcsToPalette = matWcsToPalette;
                result = true;
            }
            return(result);
        }
Esempio n. 4
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Application   app   = uiapp.Application;

            doc = uidoc.Document;
            Selection        sel      = uidoc.Selection;
            Reference        ef       = sel.PickObject(ObjectType.Element, new AssemblySelectionfilter(), "Select Assembly");
            Element          ele      = doc.GetElement(ef);
            AssemblyInstance instance = ele as AssemblyInstance;

            elesource = ElementtransformToCopy.Elementcopy(doc, instance);
            ElementtransformToCopy tr = new ElementtransformToCopy();

            dic_element = GetElements(doc, instance);
            listtarget  = Selectionceg.SelectionbyControl_Mark(doc, elesource);
            using (FrmCopyReforcement form = new FrmCopyReforcement(this, doc))
            {
                form.ShowDialog();
                if (form.listcopy.Count != 0)
                {
                    tr.CopyElements(doc, elesource, listtarget, form.listcopy);
                }
            }
            return(Result.Succeeded);
        }
Esempio n. 5
0
        // Token: 0x060000E9 RID: 233 RVA: 0x000091B8 File Offset: 0x000073B8
        protected internal override void InitializeFromAssembly(AssemblyInstance assemblyInstance)
        {
            bool flag = assemblyInstance == null;

            if (!flag)
            {
                Wall                wall         = assemblyInstance.getMainElement() as Wall;
                ItGeMatrix3d        mat          = ItGeMatrix3d.rotation(-1.5707963267948966, ItGeVector3d.kXAxis, ItGePoint3d.kOrigin);
                ItGeMatrix3d        itGeMatrix3d = ItGeMatrix3d.translation(new ItGeVector3d(0.0, 0.0, wall.thickness()));
                Position            position     = Position.Undefined;
                RevitElement <Part> part         = assemblyInstance.getPart(null);
                bool                flag2        = part.isNotNull();
                if (flag2)
                {
                    position = part.getViewsidePosition();
                }
                ItGeMatrix3d mat2  = ItGeMatrix3d.kIdentity;
                bool         flag3 = position != Position.Right;
                if (flag3)
                {
                    ItGeBoundBlock3d localExtents = assemblyInstance.getLocalExtents();
                    ItGePoint3d      itGePoint3d  = localExtents.midPoint;
                    itGePoint3d = itGeMatrix3d * mat * itGePoint3d;
                    mat2        = ItGeMatrix3d.rotation(3.1415926535897931, ItGeVector3d.kYAxis, itGePoint3d);
                }
                base.MatAssemblyToPalette = mat2 * itGeMatrix3d * mat;
                base.InitializeFromAssembly(assemblyInstance);
            }
        }
Esempio n. 6
0
 public static bool CanAssembling(this Element e)
 {
     return(AssemblyInstance.AreElementsValidForAssembly(e.Document, new List <ElementId> {
         e.Id
     },
                                                         ElementId.InvalidElementId));
 }
Esempio n. 7
0
        // Token: 0x060000D5 RID: 213 RVA: 0x00008ECC File Offset: 0x000070CC
        protected override bool ExportUnitechnik(AssemblyInstance assemblyInstance, IEnumerable <RevitElement <Part> > parts, int iProdNo, CNCProjectData projectData)
        {
            Floor floor;

            if (parts == null)
            {
                floor = null;
            }
            else
            {
                RevitElement <Part> revitElement = parts.FirstOrDefault <RevitElement <Part> >();
                floor = ((revitElement != null) ? revitElement.getFloor() : null);
            }
            Floor floor2 = floor;
            bool  flag   = floor2 == null;
            bool  result;

            if (flag)
            {
                ItFailures.PostFailure(ItFailures.UnitechnikFailure, assemblyInstance.Id);
                result = false;
            }
            else
            {
                result = base.ExportUnitechnik(assemblyInstance, parts, iProdNo, projectData);
            }
            return(result);
        }
        /// <summary>
        /// Exports an element as an IFC assembly.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The IFCProductWrapper.</param>
        /// <returns>True if exported successfully, false otherwise.</returns>
        public static bool ExportAssemblyInstanceElement(ExporterIFC exporterIFC, AssemblyInstance element,
            IFCProductWrapper productWrapper)
        {
            if (element == null)
                return false;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, element))
                {
                    string guid = ExporterIFCUtils.CreateGUID(element);
                    IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
                    string name = exporterIFC.GetName();
                    string objectType = exporterIFC.GetFamilyName();
                    IFCAnyHandle localPlacement = placementSetter.GetPlacement();
                    IFCAnyHandle representation = null;
                    string elementTag = NamingUtil.CreateIFCElementId(element);
                    IFCElementAssemblyType predefinedType = GetPredefinedTypeFromObjectType(objectType);

                    IFCAnyHandle assemblyInstanceHnd = IFCInstanceExporter.CreateElementAssembly(file, guid,
                        ownerHistory, name, null, objectType, localPlacement, representation, elementTag,
                        IFCAssemblyPlace.NotDefined, predefinedType);

                    productWrapper.AddElement(assemblyInstanceHnd, placementSetter.GetLevelInfo(), null, true);

                    PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);

                    ExporterCacheManager.AssemblyInstanceCache.RegisterAssemblyInstance(element.Id, assemblyInstanceHnd);
                }
                tr.Commit();
                return true;
            }
        }
        public FamilyInstance GetVolumnAssembly(Document doc, AssemblyInstance assemblyInstance, out string Val)
        {
            FamilyInstance        familyInstance = null;
            List <FamilyInstance> list           = new List <FamilyInstance>();
            var member = assemblyInstance.GetMemberIds().ToList();

            foreach (var item in member)
            {
                var e = doc.GetElement(item);
                if (e.Category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFraming)
                {
                    list.Add(e as FamilyInstance);
                    familyInstance = e as FamilyInstance;
                }
                if (e.Name.Contains("CORBEL"))
                {
                    list.Add(e as FamilyInstance);
                }
            }
            double Giatri = 0;

            foreach (var item in list)
            {
                Parameter volume = item.LookupParameter("Volume");
                double    Value  = volume.AsDouble();
                Giatri = Giatri + Value;
            }
            double kl = Giatri * 150;
            double k1 = Math.Round(kl / 1000, 1);
            double k2 = k1 * 1000;
            double k3 = Math.Ceiling(k2) + 50;

            Val = k3.ToString();
            return(familyInstance);
        }
Esempio n. 10
0
        public void Excute(Document doc, AssemblyInstance assemblyInstance)
        {
            FamilyInstance        Skin       = FIlterstructuralframming(assemblyInstance);
            List <FamilyInstance> Frames     = FIlterFrame(assemblyInstance);
            List <FamilyInstance> Connecions = FIlterConnections(assemblyInstance);
            var    symbol = Get3dsymbol(doc);
            XYZ    Center1;
            double Volumns1;

            GetCenterPoinSkintSolids(Solidhelper.AllSolids(Skin), out Center1, out Volumns1);
            XYZ    Center2;
            double Volumns2;

            CaculatorSolidFrame(Frames, out Center2, out Volumns2);
            XYZ    Center3;
            double Volumns3;

            CaculatorSolidConnections(Connecions, out Center3, out Volumns3);
            double x = 0;
            double y = 0;
            double z = 0;

            x = ((Center1.X) * Volumns1 * 150 + (Center2.X) * Volumns2 * 490 + (Center3.X) * Volumns3 * 490) / (Volumns1 * 150 + Volumns2 * 490 + Volumns3 * 490);
            y = ((Center1.Y) * Volumns1 * 150 + (Center2.Y) * Volumns2 * 490 + (Center3.Y) * Volumns3 * 490) / (Volumns1 * 150 + Volumns2 * 490 + Volumns3 * 490);
            z = ((Center1.Z) * Volumns1 * 150 + (Center2.Z) * Volumns2 * 490 + (Center3.Z) * Volumns3 * 490) / (Volumns1 * 150 + Volumns2 * 490 + Volumns3 * 490);
            var ft = new XYZ(x, y, z);

            PlaceSymbol(doc, symbol, ft, Skin);
        }
Esempio n. 11
0
        // Token: 0x06000003 RID: 3 RVA: 0x000021B4 File Offset: 0x000003B4
        internal static string ExportReinforcementSnippet(AssemblyInstance assembly, FileFormat fileFormat, ICollection <ExportReinfData> exportedElements, Func <Element, bool> filter = null)
        {
            bool flag = filter == null;

            if (flag)
            {
                filter = ((Element element) => true);
            }
            string result;

            switch (fileFormat)
            {
            case FileFormat.Unitechnik52:
            case FileFormat.Unitechnik60:
                result = CamExporter.ExportReinforcementToUnitechnik(assembly, fileFormat, exportedElements, filter);
                break;

            case FileFormat.PXML13:
                result = CamExporter.ExportReinforcementToPXML(assembly, exportedElements, filter);
                break;

            default:
                throw new InvalidOperationException("Unknown file format for CAM export.");
            }
            return(result);
        }
Esempio n. 12
0
        // Token: 0x0600006E RID: 110 RVA: 0x0000522C File Offset: 0x0000342C
        protected override bool ExportPxml(AssemblyInstance assemblyInstance, IEnumerable <RevitElement <Part> > part, ItDocument cncDoc, CNCProjectData projectData)
        {
            RevitElement <Part> firstShell;
            RevitElement <Part> secondShell;

            ItMachineDataWallML.GetShells(assemblyInstance, out firstShell, out secondShell);
            ItMachineDataWallDB.DbwElementData dbwElementData = new ItMachineDataWallDB.DbwElementData(base.MatWcsToPalette, firstShell, secondShell);
            ItMachineDataWallDB.DetermineCombinedBoundingBox(dbwElementData);
            ItMachineDataWallDB.DetermineDoubleWallGap(dbwElementData);
            int doubleWallGapInMM = (int)Math.Round(dbwElementData.Gap.FeetToMeter() * 1000.0);

            ItMachineDataWallDB.DetermineShellTransformations(dbwElementData);
            bool flag  = this.ExportShellToPxml(cncDoc, assemblyInstance, projectData, dbwElementData.FirstShell, doubleWallGapInMM);
            bool flag2 = !flag;
            bool result;

            if (flag2)
            {
                result = false;
            }
            else
            {
                flag   = this.ExportShellToPxml(cncDoc, assemblyInstance, projectData, dbwElementData.SecondShell, doubleWallGapInMM);
                result = flag;
            }
            return(result);
        }
        public FamilyInstance Getstructuralframming(Document doc)
        {
            AssemblyInstance        instance       = doc.GetElement(doc.ActiveView.AssociatedAssemblyInstanceId) as AssemblyInstance;
            ICollection <ElementId> member         = instance.GetMemberIds();
            FamilyInstance          familyInstance = doc.GetElement((from x in member where doc.GetElement(x).Category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFraming select x).First()) as FamilyInstance;

            return(familyInstance);
        }
Esempio n. 14
0
        // Token: 0x060000D6 RID: 214 RVA: 0x00008F20 File Offset: 0x00007120
        protected internal override void InitializeFromAssembly(AssemblyInstance assemblyInstance)
        {
            ItGeMatrix3d     itGeMatrix3d     = ItGeMatrix3d.rotation(-1.5707963267948966, ItGeVector3d.kZAxis, ItGePoint3d.kOrigin);
            ItGeBoundBlock3d itGeBoundBlock3d = assemblyInstance.getLocalExtents().transformBy(itGeMatrix3d);

            base.MatAssemblyToPalette = ItGeMatrix3d.translation(itGeBoundBlock3d.minPoint.asVector().negate()) * itGeMatrix3d;
            base.InitializeFromAssembly(assemblyInstance);
        }
Esempio n. 15
0
        /// <summary>
        /// 数据的导出类
        /// </summary>
        /// <param name="assemblies"></param>
        /// <param name="options"></param>
        public ItCreatePXML(IEnumerable <AssemblyInstance> assemblies, ICamExportIntOptions options)
        {
            this._assemblies = assemblies.ToList <AssemblyInstance>();
            this._options    = options;
            AssemblyInstance assemblyInstance = this._assemblies.FirstOrDefault <AssemblyInstance>();

            this._rvtDoc = ((assemblyInstance != null) ? assemblyInstance.Document : null);
        }
        public QLAssemblyResolve(AssemblyInstance _assembly, Field qlFieldViews, List <View> viewListing)
        {
            id   = _assembly.Id.ToString();
            name = _assembly.Name;

            if (qlFieldViews != null && viewListing != null)
            {
                hasViews = viewListing.Any(v => v.AssociatedAssemblyInstanceId.IntegerValue == _assembly.Id.IntegerValue);
            }
        }
Esempio n. 17
0
        // Token: 0x0600014A RID: 330 RVA: 0x00009FF0 File Offset: 0x000081F0
        internal ReinfSorter(AssemblyInstance assembly, ItMachineDataBase.CNCElementData cncElementData, ItGeMatrix3d matWcsToPalette, Func <Element, bool> additionalFilter)
        {
            this.CNCElementData   = cncElementData;
            this.MatWcsToPalette  = matWcsToPalette;
            this.AdditionalFilter = additionalFilter;
            ICollection <ElementId> memberIds = assembly.GetMemberIds();

            this.members = (from id in memberIds
                            select assembly.Document.GetElement(id)).ToList <Element>();
            this.steelGroupElements = new List <SteelGroupElement>();
        }
Esempio n. 18
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Application   app   = uiapp.Application;

            doc = uidoc.Document;
            Selection        sel      = uidoc.Selection;
            Reference        ef       = sel.PickObject(ObjectType.Element, new AssemblySelectionfilter(), "Select Assembly");
            Element          ele      = doc.GetElement(ef);
            AssemblyInstance instance = ele as AssemblyInstance;

            elesource   = ElementtransformToCopy.Elementcopy(doc, instance);
            dic_element = GetElements(doc, instance);
            ElementtransformToCopy tr = new ElementtransformToCopy();
            IList <Reference>      rt = sel.PickObjects(ObjectType.Element, "Select element");

            foreach (Reference k in rt)
            {
                Element it = doc.GetElement(k);
                if (it.Category.Name == "Assemblies")
                {
                    FamilyInstance elementins = ElementtransformToCopy.Elementcopy(doc, it as AssemblyInstance);
                    listtarget.Add(elementins);
                }
                else
                {
                    FamilyInstance ol = it as FamilyInstance;
                    listtarget.Add(ol);
                }
            }
            using (FrmCopyReforcementNotMark form = new FrmCopyReforcementNotMark(this, doc))
            {
                form.ShowDialog();
                if (form.listcopy.Count != 0)
                {
                    tr.CopyElements(doc, elesource, listtarget, form.listcopy);
                }
            }
            //using (FrmCopyReforcementNotMarkWPF form = new FrmCopyReforcementNotMarkWPF(this, doc))
            //{
            //    form.ShowDialog();
            //    if (form.listcopy.Count != 0)
            //    {
            //        tr.CopyElements(doc, elesource, listtarget, form.listcopy);
            //    }
            //}
            return(Result.Succeeded);
        }
Esempio n. 19
0
        public List <FamilyInstance> FIlterAllstructuralFramming(AssemblyInstance assemblyInstance)
        {
            List <FamilyInstance> list = new List <FamilyInstance>();
            var col = assemblyInstance.GetMemberIds();

            foreach (var item in col)
            {
                if (doc.GetElement(item).Category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFraming)
                {
                    FamilyInstance familyInstance = doc.GetElement(item) as FamilyInstance;
                    list.Add(familyInstance);
                }
            }
            return(list);
        }
Esempio n. 20
0
        public FamilyInstance FIlterstructuralframming(AssemblyInstance assemblyInstance)
        {
            FamilyInstance familyInstance = null;
            var            col            = assemblyInstance.GetMemberIds();

            foreach (var item in col)
            {
                if (doc.GetElement(item).Name.Contains("NE") || doc.GetElement(item).Name.Contains("Touchdown") || doc.GetElement(item).Name.Contains("SE") || doc.GetElement(item).Name.Contains("NW") || doc.GetElement(item).Name.Contains("3") || doc.GetElement(item).Name.Contains("G3"))
                {
                    familyInstance = doc.GetElement(item) as FamilyInstance;
                    break;
                }
            }
            return(familyInstance);
        }
Esempio n. 21
0
        public List <FamilyInstance> FIlterFrame(AssemblyInstance assemblyInstance)
        {
            List <FamilyInstance> List = new List <FamilyInstance>();
            var col = assemblyInstance.GetMemberIds();

            foreach (var item in col)
            {
                if (doc.GetElement(item).Name.Contains("FRAME"))
                {
                    var familyInstance = doc.GetElement(item) as FamilyInstance;
                    List.Add(familyInstance);
                }
            }
            return(List);
        }
Esempio n. 22
0
        public Dictionary <string, List <ViewSheet> > AssemblySheetDictionary(Document doc)
        {
            Dictionary <string, List <ViewSheet> > dictionary = new Dictionary <string, List <ViewSheet> >();
            FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
            IList <Element>          list = filteredElementCollector.OfClass(typeof(ViewSheet)).ToElements();

            foreach (Element element in list)
            {
                ViewSheet viewSheet = element as ViewSheet;
                bool      flag      = viewSheet == null;
                if (!flag)
                {
                    AssemblyInstance assemblyInstance = doc.GetElement(viewSheet.AssociatedAssemblyInstanceId) as AssemblyInstance;
                    bool             flag2            = assemblyInstance == null;
                    if (!flag2)
                    {
                        string assemblyTypeName = assemblyInstance.AssemblyTypeName;
                        bool   flag3            = dictionary.ContainsKey(assemblyTypeName);
                        if (flag3)
                        {
                            bool flag4 = !dictionary[assemblyTypeName].Contains(viewSheet);
                            if (flag4)
                            {
                                dictionary[assemblyTypeName].Add(viewSheet);
                            }
                        }
                        bool flag5 = !dictionary.ContainsKey(assemblyTypeName);
                        if (flag5)
                        {
                            dictionary[assemblyTypeName] = new List <ViewSheet>
                            {
                                viewSheet
                            };
                        }
                    }
                }
            }
            List <string> list2 = dictionary.Keys.ToList <string>();

            list2.Sort();
            Dictionary <string, List <ViewSheet> > dictionary2 = new Dictionary <string, List <ViewSheet> >();

            foreach (string key in list2)
            {
                dictionary2[key] = dictionary[key];
            }
            return(dictionary2);
        }
        public FormSelectElements(Document doc, UIApplication uiapp)
        {
            InitializeComponent();
            this.uiapp = uiapp;
            this.doc   = doc;
            FilteredElementCollector assemblies = new FilteredElementCollector(doc).OfClass(typeof(AssemblyInstance));

            listView1.View = System.Windows.Forms.View.Details;

            ElementClassFilter       familyinstance = new ElementClassFilter(typeof(FamilyInstance));
            ElementCategoryFilter    framingfilter  = new ElementCategoryFilter(BuiltInCategory.OST_StructuralFraming);
            FilteredElementCollector collector      = new FilteredElementCollector(doc, doc.ActiveView.Id);

            framing        = collector.WherePasses(framingfilter).WhereElementIsNotElementType().ToElements().ToList();
            listView2.View = System.Windows.Forms.View.Details;
            foreach (var ass in assemblies)
            {
                ListViewItem     item        = new ListViewItem();
                AssemblyInstance assinstance = doc.GetElement(ass.Id) as AssemblyInstance;
                if (assinstance != null)
                {
                    listassemblies.Add(assinstance);
                    item.SubItems.Add(assinstance.AssemblyTypeName);
                }
                listView1.Items.Add(item);
            }
            foreach (var fra in framing)
            {
                ListViewItem item = new ListViewItem();
                if (fra != null)
                {
                    try
                    {
                        Parameter controlmark = fra.LookupParameter("CONTROL_MARK");
                        listcontrolmark.Add(fra);
                        item.SubItems.Add(controlmark.AsString());
                        Parameter controlnumber = fra.LookupParameter("CONTROL_NUMBER");
                        item.SubItems.Add(controlnumber.AsString());
                    }
                    catch
                    {
                    }
                    string name = fra.Name;
                    item.SubItems.Add(name);
                }
                listView2.Items.Add(item);
            }
        }
Esempio n. 24
0
        // Token: 0x06000048 RID: 72 RVA: 0x0000407C File Offset: 0x0000227C
        public static ItMachineDataBase getCNCDocCreator(AssemblyInstance assemblyInstance, ICamExportIntOptions options)
        {
            ItMachineDataBase itMachineDataBase = null;
            ProductType       productType       = assemblyInstance.productType();
            bool flag = ProductType.WallSD == productType;

            if (flag)
            {
                itMachineDataBase = new ItMachineDataWallSD(options);
            }
            bool flag2 = ProductType.WallSW == productType;

            if (flag2)
            {
                itMachineDataBase = new ItMachineDataWallSW(options);
            }
            bool flag3 = ProductType.WallDB == productType;

            if (flag3)
            {
                itMachineDataBase = new ItMachineDataWallDB(options);
            }
            bool flag4 = ProductType.SlabHC == productType;

            if (flag4)
            {
                itMachineDataBase = new ItMachineDataSlabHC(options);
            }
            bool flag5 = ProductType.SlabSD == productType;

            if (flag5)
            {
                itMachineDataBase = new ItMachineDataSlabSD(options);
            }
            bool flag6 = ProductType.SlabGD == productType;

            if (flag6)
            {
                itMachineDataBase = new ItMachineDataSlabGD(options);
            }
            bool flag7 = itMachineDataBase == null;

            if (flag7)
            {
                ItFailures.PostFailure(ItFailures.CAMManualCreatedAssemblyNotSupported, assemblyInstance.Id);
            }
            return(itMachineDataBase);
        }
        // lay sheetname
        public string GetSheetName(ViewSheet viewSheet)
        {
            Document document       = viewSheet.Document;
            string   text           = viewSheet.SheetNumber + "-" + viewSheet.Name;
            bool     isAssemblyView = viewSheet.IsAssemblyView;

            if (isAssemblyView)
            {
                AssemblyInstance assemblyInstance = document.GetElement(viewSheet.AssociatedAssemblyInstanceId) as AssemblyInstance;
                bool             flag             = assemblyInstance != null;
                if (flag)
                {
                    text = text + "-" + assemblyInstance.AssemblyTypeName;
                }
            }
            return(text);
        }
Esempio n. 26
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;

            doc = uidoc.Document;
            sel = uidoc.Selection;
            Reference        reference        = sel.PickObject(ObjectType.Element, new AssemblySelectionfilter(), "Select Element");
            AssemblyInstance assemblyInstance = doc.GetElement(reference) as AssemblyInstance;

            Excute(doc, assemblyInstance);
            return(Result.Succeeded);
        }
Esempio n. 27
0
        public void Filterlist(Document doc, AssemblyInstance assemblyInstance, ref List <FamilyInstance> list1, out ICollection <ElementId> Memberid)
        {
            Memberid = assemblyInstance.GetMemberIds();
            List <FamilyInstance> listinstance = new List <FamilyInstance>();

            listinstance = (from x in Memberid where !doc.GetElement(x).Category.Name.Contains("Structural Framing") select(FamilyInstance) doc.GetElement(x)).ToList();
            foreach (var item in listinstance)
            {
                ElementId faid     = item.GetTypeId();
                Element   elemtype = doc.GetElement(faid);
                Parameter pa       = elemtype.LookupParameter("IDENTITY_DESCRIPTION");
                if (pa != null)
                {
                    string pa1 = pa.AsString();
                    list1.Add(item);
                }
            }
        }
Esempio n. 28
0
        public QLAssemblyResolve(AssemblyInstance _assembly, Field qlFieldViews, List <View> viewListing, Field queryFieldForEllementCollection)
        {
            id   = _assembly.Id.ToString();
            name = _assembly.Name;

            if (qlFieldViews != null && viewListing != null)
            {
                hasViews = viewListing.Any(v => v.AssociatedAssemblyInstanceId.IntegerValue == _assembly.Id.IntegerValue);
            }

            if (queryFieldForEllementCollection != null)
            {
                var qlFamilyInstancesField         = GraphQlHelpers.GetFieldFromSelectionSet(queryFieldForEllementCollection, "qlFamilyInstances");
                var qlFabricationPartsField        = GraphQlHelpers.GetFieldFromSelectionSet(queryFieldForEllementCollection, "qlFabricationParts");
                ICollection <ElementId> elementIds = _assembly.GetMemberIds();
                qlElementCollection = new QLElementCollectionResolve(elementIds, qlFamilyInstancesField, qlFabricationPartsField);
            }
        }
Esempio n. 29
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;

            doc = uidoc.Document;
            sel = uidoc.Selection;
            Reference        reference        = sel.PickObject(ObjectType.Element, new AssemblySelectionfilter(), "Select Element");
            AssemblyInstance assemblyInstance = doc.GetElement(reference) as AssemblyInstance;
            FamilyInstance   familyInstance   = doc.GetElement(reference) as FamilyInstance;

            if (assemblyInstance != null)
            {
                using (var form = new FrmFindGravity())
                {
                    if (form.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        if (form.Allelement)
                        {
                            Excute(doc, assemblyInstance);
                        }
                        if (form.Structuralframming)
                        {
                            ExcuteForStructuralFramming(doc, assemblyInstance);
                        }
                    }
                }
                return(Result.Succeeded);
            }
            if (familyInstance != null)
            {
                ExcuteForStructuralFrammingSelect(doc, familyInstance);
                return(Result.Succeeded);
            }
            else
            {
                return(Result.Cancelled);
            }
        }
Esempio n. 30
0
        // Token: 0x06000004 RID: 4 RVA: 0x00002228 File Offset: 0x00000428
        private static string ExportReinforcementToPXML(AssemblyInstance assembly, ICollection <ExportReinfData> exportedElements, Func <Element, bool> filter)
        {
            ICamExportIntOptions options       = new CamExporter.CamExportOptionsOnlyFileFormat(FileFormat.PXML13);
            ItMachineDataBase    cncdocCreator = ItCNCDataFactory.getCNCDocCreator(assembly, options);

            cncdocCreator.InitializeFromAssembly(assembly);
            ItGeMatrix3d matWcsToPalette = cncdocCreator.MatWcsToPalette;
            ILookup <SteelGroup, SteelGroupElement> steelGroups;

            using (ItTransaction itTransaction = ItTransactionManager.Instance.start(assembly.Document, "RevitPrecast Internal Transaction", null))
            {
                ReinfSorter reinfSorter = new ReinfSorter(assembly, new ItMachineDataBase.CNCElementData(), matWcsToPalette, filter);
                reinfSorter.SortElements();
                steelGroups = reinfSorter.GetSteelGroups();
                itTransaction.rollback("Planned rollback.");
            }
            IEnumerable <ItSteel> collection = from steelGroup in steelGroups
                                               select steelGroup.Key.ToPXML(exportedElements);

            ItSlab itSlab = new ItSlab();

            itSlab.steelList.AddRange(collection);
            XmlRootAttribute root = new XmlRootAttribute("Slab")
            {
                Namespace = "http://progress-m.com/ProgressXML/Version1"
            };
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ItSlab), root);
            StringWriter  stringWriter  = new StringWriter();
            XmlWriter     xmlWriter     = XmlWriter.Create(stringWriter, new XmlWriterSettings
            {
                Indent             = false,
                OmitXmlDeclaration = true,
                NewLineHandling    = NewLineHandling.None
            });

            xmlSerializer.Serialize(xmlWriter, itSlab, ItDocument.StaticNamespaces);
            string text = stringWriter.ToString();

            text = text.Replace("</Slab>", string.Empty);
            int startIndex = text.IndexOf("<Steel ", StringComparison.Ordinal);

            return(text.Substring(startIndex));
        }
Esempio n. 31
0
        public static FamilyInstance Elementcopy(Document doc, AssemblyInstance assembly)
        {
            ICollection <ElementId> Memberid = assembly.GetMemberIds();
            FamilyInstance          instance = null;

            foreach (ElementId i in Memberid)
            {
                FamilyInstance familyInstance = doc.GetElement(i) as FamilyInstance;
                if (familyInstance != null)
                {
                    string familyName = familyInstance.Symbol.Category.Name;
                    if (familyName.Equals("Structural Framing"))
                    {
                        instance = familyInstance;
                    }
                }
            }
            return(instance);
        }
        /// <summary>
        /// Exports an element as an IFC assembly.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        /// <returns>True if exported successfully, false otherwise.</returns>
        public static bool ExportAssemblyInstanceElement(ExporterIFC exporterIFC, AssemblyInstance element,
            ProductWrapper productWrapper)
        {
            if (element == null)
                return false;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                IFCAnyHandle assemblyInstanceHnd = null;

                string guid = GUIDUtil.CreateGUID(element);
                IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
                string name = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
                string description = NamingUtil.GetDescriptionOverride(element, null);
                string objectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
                IFCAnyHandle localPlacement = null;
                IFCPlacementSetter placementSetter = null;
                IFCLevelInfo levelInfo = null;

                string ifcEnumType;
                IFCExportType exportAs = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
                if (exportAs == IFCExportType.ExportSystem)
                {
                    assemblyInstanceHnd = IFCInstanceExporter.CreateSystem(file, guid,
                        ownerHistory, name, description, objectType);

                    // Create classification reference when System has classification filed name assigned to it
                    ClassificationUtil.CreateClassification(exporterIFC, file, element, assemblyInstanceHnd);

                    HashSet<IFCAnyHandle> relatedBuildings = new HashSet<IFCAnyHandle>();
                    relatedBuildings.Add(ExporterCacheManager.BuildingHandle);

                    IFCAnyHandle relServicesBuildings = IFCInstanceExporter.CreateRelServicesBuildings(file, GUIDUtil.CreateGUID(),
                        exporterIFC.GetOwnerHistoryHandle(), null, null, assemblyInstanceHnd, relatedBuildings);
                }
                else
                {
                    using (placementSetter = IFCPlacementSetter.Create(exporterIFC, element, null, null, ExporterUtil.GetBaseLevelIdForElement(element)))
                    {
                        string elementTag = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));
                        IFCAnyHandle representation = null;

                        // We have limited support for exporting assemblies as other container types.
                        localPlacement = placementSetter.GetPlacement();
                        levelInfo = placementSetter.GetLevelInfo();
                
                        switch (exportAs)
                        {
                            case IFCExportType.ExportCurtainWall:
                                assemblyInstanceHnd = IFCInstanceExporter.CreateCurtainWall(file, guid,
                                    ownerHistory, name, description, objectType, localPlacement, representation, elementTag);
                                break;
                            case IFCExportType.ExportRamp:
                                IFCRampType rampPredefinedType = RampExporter.GetIFCRampType(ifcEnumType);
                                assemblyInstanceHnd = IFCInstanceExporter.CreateRamp(file, guid,
                                    ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                    rampPredefinedType);
                                break;
                            case IFCExportType.ExportRoof:
                                IFCRoofType roofPredefinedType = RoofExporter.GetIFCRoofType(ifcEnumType);
                                assemblyInstanceHnd = IFCInstanceExporter.CreateRoof(file, guid,
                                    ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                    roofPredefinedType);
                                break;
                            case IFCExportType.ExportStair:
                                IFCStairType stairPredefinedType = StairsExporter.GetIFCStairType(ifcEnumType);
                                assemblyInstanceHnd = IFCInstanceExporter.CreateStair(file, guid,
                                    ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                    stairPredefinedType);
                                break;
                            case IFCExportType.ExportWall:
                                assemblyInstanceHnd = IFCInstanceExporter.CreateWall(file, guid,
                                    ownerHistory, name, description, objectType, localPlacement, representation, elementTag);
                                break;
                            default:
                                IFCElementAssemblyType assemblyPredefinedType = GetPredefinedTypeFromObjectType(objectType);
                                assemblyInstanceHnd = IFCInstanceExporter.CreateElementAssembly(file, guid,
                                    ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                    IFCAssemblyPlace.NotDefined, assemblyPredefinedType);
                                break;
                        }
                    }
                }

                if (assemblyInstanceHnd == null)
                    return false;

                bool relateToLevel = (levelInfo != null);
                productWrapper.AddElement(element, assemblyInstanceHnd, levelInfo, null, relateToLevel);

                ExporterCacheManager.AssemblyInstanceCache.RegisterAssemblyInstance(element.Id, assemblyInstanceHnd);

                tr.Commit();
                return true;
            }
        }
        /// <summary>
        /// Exports an element as an IFC assembly.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        /// <returns>True if exported successfully, false otherwise.</returns>
        public static bool ExportAssemblyInstanceElement(ExporterIFC exporterIFC, AssemblyInstance element,
            ProductWrapper productWrapper)
        {
            if (element == null)
                return false;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, element))
                {
                    string ifcEnumType;
                    IFCExportType exportAs = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType);
                    IFCAnyHandle assemblyInstanceHnd = null;
        
                    string guid = GUIDUtil.CreateGUID(element);
                    IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
                    string name = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
                    string description = NamingUtil.GetDescriptionOverride(element, null);
                    string objectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
                    IFCAnyHandle localPlacement = placementSetter.GetPlacement();
                    IFCAnyHandle representation = null;
                    string elementTag = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));

                    // We have limited support for exporting assemblies as other container types.
                    switch (exportAs)
                    {
                        case IFCExportType.ExportCurtainWall:
                            assemblyInstanceHnd = IFCInstanceExporter.CreateCurtainWall(file, guid,
                                ownerHistory, name, description, objectType, localPlacement, representation, elementTag);
                            break;
                        case IFCExportType.ExportRamp:
                            IFCRampType rampPredefinedType = RampExporter.GetIFCRampType(ifcEnumType);
                            assemblyInstanceHnd = IFCInstanceExporter.CreateRamp(file, guid,
                                ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                rampPredefinedType);
                            break;
                        case IFCExportType.ExportRoof:
                            IFCRoofType roofPredefinedType = RoofExporter.GetIFCRoofType(ifcEnumType);
                            assemblyInstanceHnd = IFCInstanceExporter.CreateRoof(file, guid,
                                ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                roofPredefinedType);
                            break;
                        case IFCExportType.ExportStair:
                            IFCStairType stairPredefinedType = StairsExporter.GetIFCStairType(ifcEnumType);
                            assemblyInstanceHnd = IFCInstanceExporter.CreateStair(file, guid,
                                ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                stairPredefinedType);
                            break;
                        case IFCExportType.ExportWall:
                            assemblyInstanceHnd = IFCInstanceExporter.CreateWall(file, guid,
                                ownerHistory, name, description, objectType, localPlacement, representation, elementTag);
                            break;
                        default:
                            IFCElementAssemblyType assemblyPredefinedType = GetPredefinedTypeFromObjectType(objectType);
                            assemblyInstanceHnd = IFCInstanceExporter.CreateElementAssembly(file, guid,
                                ownerHistory, name, description, objectType, localPlacement, representation, elementTag,
                                IFCAssemblyPlace.NotDefined, assemblyPredefinedType);
                            break;
                    }

                    if (assemblyInstanceHnd == null)
                        return false;

                    productWrapper.AddElement(assemblyInstanceHnd, placementSetter.GetLevelInfo(), null, true);

                    PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);

                    ExporterCacheManager.AssemblyInstanceCache.RegisterAssemblyInstance(element.Id, assemblyInstanceHnd);
                }
                tr.Commit();
                return true;
            }
        }