Beispiel #1
0
//#define FILEPOS_EOF                     0
//#define FILEPOS_CURRENT                 1
//#define FILEPOS_FIRST_ELE               2
//#define FILEPOS_NEXT_ELE                3
//#define FILEPOS_WORKING_SET             4
//#define FILEPOS_COMPONENT               5
//#define FILEPOS_NEXT_NEW_ELEMENT        6

        private void btnAddToModel_Click(object sender, EventArgs e)
        {
            previewTranContainer.Reset();

            BCOM.Level     activeLevel      = Addin.App.ActiveSettings.Level;
            BCOM.LineStyle activeLineStyle  = Addin.App.ActiveSettings.LineStyle;
            int            activeLineWeight = Addin.App.ActiveSettings.LineWeight;
            int            activeColor      = Addin.App.ActiveSettings.Color;

            var activeModel = Addin.App.ActiveModelReference;

            try
            {
                foreach (var pair in getFramesData())
                {
                    TFCOM.TFFrameList frameList = pair.Key;
                    PenetrTask        task      = pair.Value;

                    {
                        // ! без этого кода не срабатывает перфорация в стенке/плите
                        // судя по всему инициализирует обновление объектов, с которыми
                        // взаимодействует frame

                        Addin.AppTF.ModelReferenceUpdateAutoOpeningsByFrame(
                            activeModel, frameList.AsTFFrame, true, false,
                            TFCOM.TFdFramePerforationPolicy.tfdFramePerforationPolicyNone);
                    }
                    // добавление в модель
                    Addin.AppTF.ModelReferenceAddFrameList(
                        Addin.App.ActiveModelReference, frameList);

                    BCOM.Element newElement = activeModel.GetLastValidGraphicalElement();
                    setDataGroupInstance(newElement, task);

                    { // TODO ОТЛАДКА:
                      //XmlInstanceSchemaManager modelSchema =
                      //        new XmlInstanceSchemaManager((IntPtr)newElement.ModelReference.MdlModelRefP());

                        //    XmlInstanceApi api = XmlInstanceApi.CreateApi(modelSchema);
                        //    IList<string> instances = api.ReadInstances((IntPtr)newElement.MdlElementRef());

                        //    foreach (string inst in instances)
                        //    {
                        //        string instId = XmlInstanceApi.GetInstanceIdFromXmlInstance(inst);
                        //    }
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowMessage();
            }
            finally
            {
                Addin.App.ActiveSettings.Level      = activeLevel;
                Addin.App.ActiveSettings.LineStyle  = activeLineStyle;
                Addin.App.ActiveSettings.LineWeight = activeLineWeight;
                Addin.App.ActiveSettings.Color      = activeColor;
            }
        }
Beispiel #2
0
        public static void RunByRecovertingSettings(Action action, params object[] args)
        {
            var activeSets = App.ActiveSettings;

            BCOM.Level     activeLevel      = activeSets.Level;
            BCOM.LineStyle activeLineStyle  = activeSets.LineStyle;
            int            activeLineWeight = activeSets.LineWeight;
            int            activeColor      = activeSets.Color;

            try
            {
                action?.DynamicInvoke(args);
            }
            catch (Exception ex)
            {
                ex.ShowMessageBox();
            }
            finally
            {
                activeSets.Level      = activeLevel;
                activeSets.LineStyle  = activeLineStyle;
                activeSets.LineWeight = activeLineWeight;
                activeSets.Color      = activeColor;
            }
        }