Esempio n. 1
0
        private RFEMobjectOps.MatchSurfacePropertiesSettings processMatchSurfaceProps()
        {
            RFEMobjectOps.MatchSurfacePropertiesSettings matchSettings = new RFEMobjectOps.MatchSurfacePropertiesSettings();

            //thickness
            if (MatchSrfThickness.Checked == true)
            {
                matchSettings.Thickness = true;
            }
            else
            {
                matchSettings.Thickness = false;
            }

            //material
            if (MatchSrfMaterial.Checked == true)
            {
                matchSettings.MaterialNo = true;
            }
            else
            {
                matchSettings.MaterialNo = false;
            }

            //stiffness
            if (MatchSrfStiffness.Checked == true)
            {
                matchSettings.StiffnessType = true;
            }
            else
            {
                matchSettings.StiffnessType = false;
            }

            //comment
            if (MatchSrfComment.Checked == true)
            {
                matchSettings.Comment = true;
            }
            else
            {
                matchSettings.Comment = false;
            }


            return(matchSettings);
        }
Esempio n. 2
0
        public static void MatchSurfaceProps(RFEMobjectOps.MatchSurfacePropertiesSettings matchPropSettings)
        {
            IModel     model     = RFEMconnection.getRFEMconnection();
            IModelData modelData = model.GetModelData();
            IView      view      = model.GetActiveView();

            //select Source surface //
            Common.IO.Log("Select one source surface!");
            List <Surface> sourceSurfaces = RFEMselectOps.selectSurfaces(model);

            if (sourceSurfaces.Count == 0)
            {
                Common.IO.Log("");
                return;
            }
            Surface sourceSurface = sourceSurfaces[0];


            //select Destination surfaces
            Common.IO.Log("Select one or multiple destination surfaces!");

            List <Surface> destinationSurfaces = RFEMselectOps.selectSurfaces(model);

            if (destinationSurfaces.Count == 0)
            {
                Common.IO.Log("");
                return;
            }


            List <Surface> surfacesToWrite = new List <Surface>();

            foreach (Surface surface in destinationSurfaces)
            {
                Surface targetSurface = new Surface();
                RFEMobjectOps.MatchSurfaceProperties(sourceSurface, ref targetSurface, matchPropSettings);
                targetSurface.No = surface.No;
                targetSurface.BoundaryLineList = surface.BoundaryLineList;
                surfacesToWrite.Add(targetSurface);
            }


            try
            {
                //prepares model for modification and writes data
                modelData.PrepareModification();

                foreach (Surface surfaceToWrite in surfacesToWrite)
                {
                    modelData.SetSurface(surfaceToWrite);
                }

                //finishes modifications - regenerates numbering etc.
                modelData.FinishModification();
                Common.IO.Log("Surface properties have been matched");
            }
            catch (Exception ex)
            {
                Common.IO.Log("Error in matching the surface properties");
                MessageBox.Show(ex.Message, "Error - Surface Write", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //closing the connection with RFEM
                RFEMconnection.closeRFEMconnection(model);
            }
        }
Esempio n. 3
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     RFEMobjectOps.MatchSurfacePropertiesSettings matchSettings = processMatchSurfaceProps();
     MatchProps.MatchSurfaceProps(matchSettings);
 }
Esempio n. 4
0
        /// <summary>
        /// Method for spliting surfaces with line
        /// Takes no arguments, because surface and line is selected in RFEM surface
        /// </summary>
        public static void splitSurfaces()
        {
            IModel     model     = RFEMconnection.getRFEMconnection();
            IModelData modelData = model.GetModelData();

            IView view = model.GetActiveView();

            //select surface - cast to be used because selectObjects returns generic "object"
            Common.IO.Log("Select one surface to split!");
            List <Surface> selectedSurfaces = RFEMselectOps.selectSurfaces(model);

            if (selectedSurfaces.Count == 0)
            {
                Common.IO.Log("");
                return;
            }

            Surface selectedSurface   = selectedSurfaces[0];
            int     selectedSurfaceNo = selectedSurface.No;

            //select line - cast to be used because selectObjects returns generic "object"
            Common.IO.Log("Select one line to split with!");
            List <Line> selectedLines = RFEMselectOps.selectLines(model);

            if (selectedLines.Count == 0)
            {
                Common.IO.Log("");
                return;
            }

            int splitLineNo = selectedLines[0].No;

            //get boundary lines of existing surface
            string     boundaryLinesListString = selectedSurface.BoundaryLineList;
            List <int> boundaryLinesList       = ListOperations.objectNumbersToList(boundaryLinesListString);

            //get boundary lines of split surfaces
            List <List <int> > newSurfacesBoundLines = getBoundaryLinesOfSplitSurfaces(modelData, boundaryLinesList, splitLineNo);

            //Define new surfaces using existing surface data as a template
            Surface newSplitSurface1 = new Surface();
            Surface newSplitSurface2 = new Surface();


            //first surface will keep the number or original surface
            RFEMobjectOps.MatchSurfacePropertiesSettings surfMatchPropsSurf1 = new RFEMobjectOps.MatchSurfacePropertiesSettings();
            surfMatchPropsSurf1.No = true;
            //for second one, new number will be assigned
            RFEMobjectOps.MatchSurfacePropertiesSettings surfMatchPropsSurf2 = new RFEMobjectOps.MatchSurfacePropertiesSettings();
            int nextAvailableSurfaceNo = modelData.GetLastObjectNo(ModelObjectType.SurfaceObject) + 1;

            newSplitSurface2.No = nextAvailableSurfaceNo;

            //match properties
            RFEMobjectOps.MatchSurfaceProperties(selectedSurface, ref newSplitSurface1, surfMatchPropsSurf1);
            RFEMobjectOps.MatchSurfaceProperties(selectedSurface, ref newSplitSurface2, surfMatchPropsSurf2);

            //convert list of integers to RFEM text, assign these to newly created surfaces
            newSplitSurface1.BoundaryLineList = ListOperations.objectNumbersToSting(newSurfacesBoundLines[0]);
            newSplitSurface2.BoundaryLineList = ListOperations.objectNumbersToSting(newSurfacesBoundLines[1]);


            try
            {
                //prepares model for modification and writes data
                modelData.PrepareModification();
                modelData.SetSurface(newSplitSurface1);
                modelData.SetSurface(newSplitSurface2);

                //finishes modifications - regenerates numbering etc.
                modelData.FinishModification();
                Common.IO.Log("Surface has been split in two");
            }
            catch (Exception ex)
            {
                Common.IO.Log("Error in splitting the surface");
                MessageBox.Show(ex.Message, "Error - Surface Write", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //closing the connection with RFEM
                RFEMconnection.closeRFEMconnection(model);
            }
        }