Esempio n. 1
0
        private string BuildNodesetCompilerArgs(string modelName, IModelData modelData, List <RequiredModelsData> requiredModelsData)
        {
            // Build model source and target paths
            var modelSourceRelativePath = @"../../" + _fileSystem.CombinePaths(Constants.DirectoryName.Models, modelData.Name);
            var modelTargetRelativePath = _fileSystem.CombinePaths(Constants.DirectoryName.InformationModels, modelName);

            // Build nodeset compiler script arguments:
            // add compiler path, internal headers flag and basic nodeset types
            StringBuilder compilerArgs = new StringBuilder(Constants.ExecutableName.NodesetCompilerCompilerPath + Constants.ExecutableName.NodesetCompilerInternalHeaders + string.Format(Constants.ExecutableName.NodesetCompilerTypesArray, Constants.ExecutableName.NodesetCompilerBasicTypes));

            // add types for each required nodeset
            foreach (var nodeset in requiredModelsData)
            {
                var requiredModelTypes = nodeset.RequiredTypes ? (_fileSystem.GetFileNameWithoutExtension(nodeset.ModelName) + Constants.InformationModelsName.Types).ToUpper() : Constants.ExecutableName.NodesetCompilerBasicTypes;
                compilerArgs.Append(string.Format(Constants.ExecutableName.NodesetCompilerTypesArray, requiredModelTypes));
            }
            // add currently compiled nodeset types and basic nodeset path
            var typesNameForScriptCall = string.IsNullOrEmpty(modelData.Types) ? Constants.ExecutableName.NodesetCompilerBasicTypes : (modelName + Constants.InformationModelsName.Types).ToUpper();

            compilerArgs.Append(string.Format(Constants.ExecutableName.NodesetCompilerTypesArray, typesNameForScriptCall) + string.Format(Constants.ExecutableName.NodesetCompilerExisting, Constants.ExecutableName.NodesetCompilerBasicNodeset));
            // add nodeset path for each required nodeset
            foreach (var nodeset in requiredModelsData)
            {
                var requiredModelRelativePath = @"../../" + _fileSystem.CombinePaths(Constants.DirectoryName.Models, nodeset.ModelName);
                compilerArgs.Append(string.Format(Constants.ExecutableName.NodesetCompilerExisting, requiredModelRelativePath));
            }
            // add currently compiled nodeset path
            compilerArgs.Append(string.Format(Constants.ExecutableName.NodesetCompilerXml, modelSourceRelativePath, modelTargetRelativePath));

            return(compilerArgs.ToString());
        }
Esempio n. 2
0
        private void GenerateCallbackFunctions(XmlNodeList methodNodes, IModelData modelData, ref List <string> currentFileContentLineByLine)
        {
            // for each method found in nodeset generate callback functions
            foreach (XmlNode node in methodNodes)
            {
                var methodBrowseName = node.Attributes[Constants.NodesetXml.UANodeSetUAMethodBrowseName].Value;
                var methodNodeId     = uint.Parse(Regex.Split(node.Attributes[Constants.NodesetXml.UANodeSetUaMethodNodeId].Value, @"\D+").Last());

                var lastUAMethodLinePosition = currentFileContentLineByLine.FindIndex(x => x.Contains(string.Format(Constants.UAMethodCallback.FunctionName, modelData.NamespaceVariable, methodNodeId)));
                if (lastUAMethodLinePosition == Constants.NumericValues.TextNotFound)
                {
                    // add callback function
                    var addCallbacksFunctionLinePosition = currentFileContentLineByLine.FindIndex(x => x.Contains(Constants.UAMethodCallback.AddCallbacks));
                    if (addCallbacksFunctionLinePosition != Constants.NumericValues.TextNotFound)
                    {
                        currentFileContentLineByLine.Insert(addCallbacksFunctionLinePosition, string.Format(Constants.UAMethodCallback.FunctionBody, methodBrowseName, modelData.Name, modelData.NamespaceVariable, methodNodeId));
                    }

                    // call callback function in addCallbacks function
                    var addCallbacksReturnLinePosition = currentFileContentLineByLine.FindLastIndex(x => x.Contains(Constants.UAMethodCallback.ReturnLine));
                    if (addCallbacksReturnLinePosition != Constants.NumericValues.TextNotFound)
                    {
                        currentFileContentLineByLine.Insert(addCallbacksReturnLinePosition, string.Format(Constants.UAMethodCallback.FunctionCall, methodBrowseName, modelData.Name, modelData.NamespaceVariable, methodNodeId));
                    }
                }
            }
        }
Esempio n. 3
0
        public MutationType(IModelData data)
        {
            Name = "Mutation";

            Field <StringGraphType>(
                "addFoo",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <FooInputType> > {
                Name = "foo"
            },
                    new QueryArgument <NonNullGraphType <BarInputType> > {
                Name = "bar"
            },
                    new QueryArgument <NonNullGraphType <BazInputType> > {
                Name = "baz"
            }
                    ),
                resolve: ctx => {
                var foo = ctx.GetArgument <FooInput>("foo");
                var bar = ctx.GetArgument <BarInput>("bar");
                var baz = ctx.GetArgument <BazInput>("baz");
                return(data.AddFoo(foo, bar, baz));
            }
                );
        }
        public static void CreateModel(Karamba.Models.Model kModel)
        {
            if (RModel != null)
            {
                Node[]         rNodes         = Nodes(kModel.nodes);
                NodalSupport[] rSupports      = Supports(kModel.supports);
                Material[]     rMaterials     = Materials(kModel.materials);
                CrossSection[] rCrossSections = CrossSections(kModel.crosecs, kModel);
                Tuple <Member[], Dlubal.RFEM5.Line[]> vali = Members(kModel.elems);
                Member[]            rMembers      = vali.Item1;
                Dlubal.RFEM5.Line[] rLines        = vali.Item2;
                LoadCase[]          lCases        = LoadCases(kModel);
                MemberLoad[]        rMemberLoads  = MemberLoads(kModel.eloads);
                NodalLoad[]         rNodalLoads   = NodalLoads(kModel.ploads);
                MemberHinge[]       rMemberHinges = MemberHinges(kModel.joints);

                //Get active RFEM5 application
                try
                {
                    IModelData rData  = RModel.GetModelData();
                    ILoads     rLoads = RModel.GetLoads();

                    //Cleans the model and load data data
                    rData.PrepareModification();
                    rData.Clean();
                    rData.FinishModification();

                    rLoads.PrepareModification();
                    rLoads.Clean();
                    rLoads.FinishModification();

                    //Model elements
                    rData.PrepareModification();

                    rData.SetNodes(rNodes);
                    rData.SetNodalSupports(rSupports);
                    rData.SetMaterials(rMaterials);
                    rData.SetCrossSections(rCrossSections);
                    rData.SetMemberHinges(rMemberHinges);
                    rData.SetLines(rLines);
                    rData.SetMembers(rMembers);

                    rData.FinishModification();

                    //Load cases
                    rLoads.PrepareModification();
                    rLoads.SetLoadCases(lCases);
                    rLoads.FinishModification();

                    //Loads
                    setRFEMmemberLoads(rLoads, rMemberLoads);
                    setRFEMnodalLoads(rLoads, rNodalLoads);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 5
0
 public EntityProvider(ITranslator translator, IElasticService elasticService, IElasticSettings elasticSettings, IModelData modelData)
 {
     this.translator      = translator;
     this.elasticService  = elasticService;
     this.elasticSettings = elasticSettings;
     this.modelData       = modelData;
 }
Esempio n. 6
0
        public static List <Plane> GetHorizontalPlanesFromMultiplePoints(IModel model)
        {
            List <Plane> planes = new List <Plane>();

            //accessing the model
            IModelData modelData = model.GetModelData();
            IView      view      = model.GetActiveView();

            //selecting multiple nodes
            Common.IO.Log("Select ONE OR MULTIPLE nodes representing horizontal planes");
            List <Node> selectedNodes = RFEMselectOps.selectNodes(model);

            if (selectedNodes.Count < 1)
            {
                Common.IO.Log("Less than ONE nodes selected");
                return(planes);
            }

            foreach (Node selectedNode in selectedNodes)
            {
                Vector3 point1 = new Vector3(0, 0, selectedNode.Z);
                Vector3 point2 = new Vector3(1, 0, selectedNode.Z);
                Vector3 point3 = new Vector3(0, 1, selectedNode.Z);

                planes.Add(new Plane(point1, point2, point3));
            }

            return(planes);
        }
Esempio n. 7
0
        public static List <Surface> selectSurfaces(IModel model)
        {
            IView      view      = model.GetActiveView();
            IModelData modelData = model.GetModelData();

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


            //select objects
            string selectedObjectsText = "";

            view.PickObjects(ToolType.SelectSurfaces, ref selectedObjectsText);

            if (selectedObjectsText == "")
            {
                return(new List <Surface>());
            }

            List <int> selectedObjectsNo = ListOperations.objectNumbersToList(selectedObjectsText);

            try
            {
                foreach (int objectNo in selectedObjectsNo)
                {
                    selectedObjects.Add(modelData.GetSurface(objectNo, ItemAt.AtNo).GetData());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(selectedObjects);
        }
Esempio n. 8
0
        public static Plane GetPlaneFrom3Points(IModel model)
        {
            Plane plane = new Plane();

            //accessing the model
            IModelData modelData = model.GetModelData();
            IView      view      = model.GetActiveView();

            //selecting three nodes
            Common.IO.Log("Select THREE nodes representing a plane");
            List <Node> selectedNodes = RFEMselectOps.selectNodes(model);

            if (selectedNodes.Count < 3)
            {
                Common.IO.Log("Less than THREE nodes selected");
                return(plane);
            }


            Vector3 point1 = RFEMgeomOps.XNAvectorFromNode(selectedNodes[0]);
            Vector3 point2 = RFEMgeomOps.XNAvectorFromNode(selectedNodes[1]);
            Vector3 point3 = RFEMgeomOps.XNAvectorFromNode(selectedNodes[2]);

            return(new Plane(point1, point2, point3));
        }
Esempio n. 9
0
        public static Plane GetVerticalPlaneFrom2Points(IModel model)
        {
            Plane plane = new Plane();

            //accessing the model
            IModelData modelData = model.GetModelData();
            IView      view      = model.GetActiveView();

            //selecting two nodes
            Common.IO.Log("Select TWO nodes representing a vertical plane");
            List <Node> selectedNodes = RFEMselectOps.selectNodes(model);

            if (selectedNodes.Count < 2)
            {
                Common.IO.Log("Less than TWO nodes selected");
                return(plane);
            }


            Vector3 point1 = RFEMgeomOps.XNAvectorFromNode(selectedNodes[0]);
            Vector3 point2 = RFEMgeomOps.XNAvectorFromNode(selectedNodes[1]);
            Vector3 point3 = new Vector3(point2.X, point2.Y, point2.Z + 1);

            return(new Plane(point1, point2, point3));
        }
 public EntityDecorator(IElasticService elasticService, IElasticSettings elasticSettings, IEntityProvider entityProvider, IModelData modelData)
 {
     this.elasticService  = elasticService;
     this.elasticSettings = elasticSettings;
     this.entityProvider  = entityProvider;
     this.modelData       = modelData;
 }
Esempio n. 11
0
        private Dictionary <IModelData, Dictionary <int, Dictionary <int, RuleExcuter> > > mRunningRules = new Dictionary <IModelData, Dictionary <int, Dictionary <int, RuleExcuter> > >();    // -- 仅记录阻塞

        public bool StartRule(int ruleID, IModelData target)
        {
            if (SearchRuleIsRunning(ruleID, target))
            {
                return(false);
            }

            CRule rule = GetRule(ruleID);

            if (null == rule)
            {
                return(false);
            }

            rule.StartRule(target);

            Dictionary <int, Dictionary <int, RuleExcuter> > runningRuleInfo;

            if (!mRunningRules.TryGetValue(target, out runningRuleInfo))
            {
                runningRuleInfo = new Dictionary <int, Dictionary <int, RuleExcuter> >();
                mRunningRules.Add(target, runningRuleInfo);
            }
            Dictionary <int, RuleExcuter> runningExcutersInfo;

            if (!runningRuleInfo.TryGetValue(ruleID, out runningExcutersInfo))
            {
                runningExcutersInfo = new Dictionary <int, RuleExcuter>();
                runningRuleInfo.Add(ruleID, runningExcutersInfo);
            }
            return(true);
        }
Esempio n. 12
0
 public void DoNext(IModelData target)
 {
     foreach (var excuter in NextExcuters)
     {
         excuter.DoExecute(target);
     }
 }
Esempio n. 13
0
 public void StartRule(IModelData target)
 {
     foreach (var executer in EnteranceExcuters.Values)
     {
         executer.DoExecute(target);
     }
 }
Esempio n. 14
0
        // 计时器完成 不包含中途退出的情况
        private void OnTimerFinish(EventTimer timer)
        {
            IModelData target = timer.Parameters[0] as IModelData;

            DoExit(target);
            DoRoute(target, ERuleKey.RouteFinish);
        }
        public static int NodeNumber(IModelData data)
        {
            int totalNodesCount = data.GetNodes().Count();
            int lastNodeNo      = data.GetNode(totalNodesCount - 1, ItemAt.AtIndex).GetData().No;

            return(lastNodeNo);
        }
Esempio n. 16
0
 protected void DoNext(IModelData target)
 {
     if (!IsMultiRoute)
     {
         return;
     }
     DoRoute(target, ERuleKey.RouteSingle);
 }
Esempio n. 17
0
        protected override void OnExecute(IModelData target)
        {
            int        triggerCount = ToolParser.IntParse(Attributes[ERuleKey.TriggerCount]);
            float      timerTime    = ToolParser.FloatParse(Attributes[ERuleKey.TimerTime]);
            EventTimer timer        = target.RegisterTimer(timerTime, new object[] { target }, OnTimerFinish, triggerCount, OnTimerTrigger);

            TimerDic.Add(this, timer);
        }
Esempio n. 18
0
 //Help method to see what crossSections there are in the model
 public static void printCrossSectionIDs(IModelData rData)
 {
     CrossSection[] crosecs = rData.GetCrossSections();
     foreach (CrossSection crosec in crosecs)
     {
         Rhino.RhinoApp.WriteLine(crosec.TextID);
     }
 }
Esempio n. 19
0
 // 离开这个组件
 public void DoExit(IModelData target)
 {
     ClearCache(target);
     if (IsBlocked)
     {
         RuleManager.Instance.RunningOver(target, this);
     }
 }
Esempio n. 20
0
 //Help method to see what materials there are in the model
 public static void printMaterialIDs(IModelData rData)
 {
     Material[] materials = rData.GetMaterials();
     foreach (Material material in materials)
     {
         Rhino.RhinoApp.WriteLine(material.TextID);
     }
 }
Esempio n. 21
0
 public void DoExecute(IModelData target)
 {
     if (IsBlocked)
     {
         RuleManager.Instance.RunningIn(target, this);
     }
     OnExecute(target);
 }
Esempio n. 22
0
        public bool GenerateTypesSourceCodeFiles(string projectName, IModelData modelData)
        {
            // Verify if model has types
            if (string.IsNullOrEmpty(modelData.Types))
            {
                return(true);
            }

            // Verify types extension
            if (_fileSystem.GetExtension(modelData.Types) != Constants.FileExtension.ModelTypes)
            {
                AppioLogger.Warn(string.Format(LoggingText.NodesetCompilerExecutableFailsInvalidFile, modelData.Types));
                _outputMessage = string.Format(OutputText.GenerateInformationModelFailureInvalidFile, projectName, modelData.Name, modelData.Types);
                return(false);
            }

            // Verify if types file exists
            var typesPath = _fileSystem.CombinePaths(projectName, Constants.DirectoryName.Models, modelData.Types);

            if (!_fileSystem.FileExists(typesPath))
            {
                AppioLogger.Warn(string.Format(LoggingText.NodesetCompilerExecutableFailsMissingFile, typesPath));
                _outputMessage = string.Format(OutputText.GenerateInformationModelFailureMissingFile, projectName, modelData.Name, typesPath);
                return(false);
            }

            // Create a directory for generated C code
            var srcDirectory = _fileSystem.CombinePaths(projectName, Constants.DirectoryName.SourceCode, Constants.DirectoryName.ServerApp);

            CreateDirectoryForGeneratedModelsSourceCode(srcDirectory);

            // Build types source file and target files directories
            var modelName = _fileSystem.GetFileNameWithoutExtension(modelData.Name);
            var typesSourceRelativePath = @"../../" + _fileSystem.CombinePaths(Constants.DirectoryName.Models, modelData.Types);
            var typesTargetRelativePath = _fileSystem.CombinePaths(Constants.DirectoryName.InformationModels, modelName.ToLower());

            // Build types generation script arguments
            var generatedTypesArgs = Constants.ExecutableName.GenerateDatatypesScriptPath +
                                     string.Format(Constants.ExecutableName.GenerateDatatypesTypeBsd, typesSourceRelativePath) +
                                     " " +
                                     typesTargetRelativePath +
                                     Constants.InformationModelsName.Types;

            // Execute types generation script call
            var generatedTypesResult = _fileSystem.CallExecutable(Constants.ExecutableName.PythonScript, srcDirectory, generatedTypesArgs);

            if (!generatedTypesResult)
            {
                AppioLogger.Warn(LoggingText.GeneratedTypesExecutableFails);
                _outputMessage = string.Format(OutputText.GenerateInformationModelGenerateTypesFailure, projectName, modelData.Name, modelData.Types);
                return(false);
            }

            // Add generated types header file to server's meson build
            AdjustServerMesonBuildCFile(srcDirectory, modelName.ToLower() + Constants.InformationModelsName.TypesGenerated);

            return(true);
        }
Esempio n. 23
0
        public static object selectObjects(IModel model, ToolType toolType)
        {
            IView      view      = model.GetActiveView();
            IModelData modelData = model.GetModelData();

            List <object> selectedObjects = new List <object>();


            //select objects
            string selectedObjectsText = "";

            view.PickObjects(toolType, ref selectedObjectsText);

            List <int> selectedObjectsNo = ListOperations.objectNumbersToList(selectedObjectsText);

            try
            {
                foreach (int objectNo in selectedObjectsNo)
                {
                    if (toolType == ToolType.SelectSurfaces)
                    {
                        selectedObjects.Add(modelData.GetSurface(objectNo, ItemAt.AtNo).GetData());
                    }
                    if (toolType == ToolType.SelectLines)
                    {
                        selectedObjects.Add(modelData.GetLine(objectNo, ItemAt.AtNo).GetData());
                    }
                    if (toolType == ToolType.SelectNodes)
                    {
                        selectedObjects.Add(modelData.GetNode(objectNo, ItemAt.AtNo).GetData());
                    }
                    if (toolType == ToolType.SelectMembers)
                    {
                        selectedObjects.Add(modelData.GetMember(objectNo, ItemAt.AtNo).GetData());
                    }
                    if (toolType == ToolType.SelectOpenings)
                    {
                        selectedObjects.Add(modelData.GetOpening(objectNo, ItemAt.AtNo).GetData());
                    }
                    if (toolType == ToolType.SelectSetsOfMembers)
                    {
                        selectedObjects.Add(modelData.GetSetOfMembers(objectNo, ItemAt.AtNo).GetData());
                    }
                    if (toolType == ToolType.SelectSolids)
                    {
                        selectedObjects.Add(modelData.GetSolid(objectNo, ItemAt.AtNo).GetData());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(selectedObjects);
        }
Esempio n. 24
0
        //Gets all the members in the model and bakes them as breps to the rhino.
        public static Tuple <Member[], Dlubal.RFEM5.CrossSection[]> GetMembers(string comment)
        {
            OpenConnection();
            try
            {
                IModelData rData = RModel.GetModelData();

                Dlubal.RFEM5.Line[]         lines     = rData.GetLines();
                Dlubal.RFEM5.CrossSection[] crossSecs = rData.GetCrossSections();
                Member[] members = rData.GetMembers();
                members = members.Where(o => o.Comment == comment).ToArray();
                List <Member> mList = new List <Member>();

                Dictionary <int, Brep> rCrossSecs = new Dictionary <int, Brep>();
                foreach (Dlubal.RFEM5.CrossSection crossSec in crossSecs)
                {
                    rCrossSecs.Add(crossSec.No, GetCrscDBShape(crossSec.TextID));
                }

                foreach (Member member in members)
                {
                    Dlubal.RFEM5.Line   line      = rData.GetLine(member.LineNo, ItemAt.AtNo).GetData();
                    Rhino.Geometry.Line rhLine    = lineRfemToRhino(line, rData);
                    Vector3d            direction = new Vector3d(rhLine.To - rhLine.From);
                    Plane     plane     = new Plane(rhLine.From, direction);
                    Brep      tempCross = (Brep)rCrossSecs[member.StartCrossSectionNo].Duplicate();
                    Transform tr        = Transform.PlaneToPlane(Plane.WorldXY, plane);
                    tempCross.Transform(tr);

                    Brep extruded = tempCross.Faces[0].CreateExtrusion(rhLine.ToNurbsCurve(), true);
                    ProjectPlugIn.Instance.beamBreps.Add(Tuple.Create(member.No, extruded));
                }

                foreach (Member m in members)
                {
                    Dlubal.RFEM5.CrossSection c = Array.Find(crossSecs, o => o.No == m.StartCrossSectionNo);
                    if (c.TextID.Split(' ')[0] == "Rechteck" || c.TextID.Split(' ')[0] == "Kreis")
                    {
                        mList.Add(m);
                    }
                }
                CloseConnection();
                return(Tuple.Create(mList.ToArray(), crossSecs));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Cleans Garbage collector for releasing all COM interfaces and objects
                System.GC.Collect();
                System.GC.WaitForPendingFinalizers();
                CloseConnection();
            }


            return(Tuple.Create <Member[], Dlubal.RFEM5.CrossSection[]>(null, null));
        }
Esempio n. 25
0
        private static Rhino.Geometry.Line lineRfemToRhino(Dlubal.RFEM5.Line line, IModelData rData)
        {
            Point3D point1 = line.ControlPoints[0];
            Point3D point2 = line.ControlPoints[line.ControlPoints.Length - 1];


            Rhino.Geometry.Line rhLine = new Rhino.Geometry.Line(new Point3d(point1.X, point1.Y, point1.Z),
                                                                 new Point3d(point2.X, point2.Y, point2.Z));
            return(rhLine);
        }
Esempio n. 26
0
 public void SetupTest()
 {
     _defaultModelData   = new ModelData(_modelFullName, null, _namespaceVariable, null);
     _fileSystemMock     = new Mock <IFileSystem>();
     _modelValidator     = new Mock <IModelValidator>();
     _loggerListenerMock = new Mock <ILoggerListener>();
     _loggerWroteOut     = false;
     _objectUnderTest    = new NodesetGenerator(_fileSystemMock.Object, _modelValidator.Object);
     AppioLogger.RegisterListener(_loggerListenerMock.Object);
 }
Esempio n. 27
0
        public List <RFNodalSupportForces> GetRFNodalSupportForces(IResults results, IModelData data)
        {
            var myForces = new List <RFNodalSupportForces>();

            foreach (var nodalsupportforce in results.GetAllNodalSupportForces(false))
            {
                myForces.Add(new RFNodalSupportForces(nodalsupportforce, data));
            }
            return(myForces);
        }
Esempio n. 28
0
        public static Point3d ToPoint3d(this Node n, IModelData data)
        {
            // A little bit of recursion in case the ref node has another ref node...
            if (n.RefObjectNo == 0)
            {
                return(new Point3d(n.X, n.Y, n.Z));
            }
            var refNode = data.GetNode(n.RefObjectNo, ItemAt.AtNo).GetData();

            return(new Point3d(new Point3d(n.X, n.Y, n.Z) + refNode.ToPoint3d(data)));
        }
Esempio n. 29
0
        public List <RFNodalSupportForces> GetRFNodalSupportForces(IResults results, IModelData data, ref HashSet <ResultsValueType> types, bool local)
        {
            var myForces = new List <RFNodalSupportForces>();

            foreach (var nodalsupportforce in results.GetAllNodalSupportForces(local))
            {
                myForces.Add(new RFNodalSupportForces(nodalsupportforce, data));
                types.Add(nodalsupportforce.Type);
            }
            return(myForces);
        }
Esempio n. 30
0
        private List <Rhino.Geometry.Point3d> ReadRfemNodes(string pointsListInput)
        {
            // Gets interface to running RFEM application.
            app = Marshal.GetActiveObject("RFEM5.Application") as IApplication;
            // Locks RFEM licence
            app.LockLicense();

            // Gets interface to active RFEM model.
            model = app.GetActiveModel();

            // Gets interface to model data.
            IModelData data = model.GetModelData();

            //Create new array for Rhino point objects
            List <Rhino.Geometry.Point3d> rhinoPointArray = new List <Rhino.Geometry.Point3d>();

            try
            {
                for (int index = 0; index < data.GetNodeCount(); index++)
                {
                    Dlubal.RFEM5.Node      currentNode      = data.GetNode(index, ItemAt.AtIndex).GetData();
                    Rhino.Geometry.Point3d currentRhinoNode = new Rhino.Geometry.Point3d();
                    currentRhinoNode.X = currentNode.X;
                    currentRhinoNode.Y = currentNode.Y;
                    currentRhinoNode.Z = currentNode.Z;

                    rhinoPointArray.Add(currentRhinoNode);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Releases interface to RFEM model.
            model = null;

            // Unlocks licence and releases interface to RFEM application.
            if (app != null)
            {
                app.UnlockLicense();
                app = null;
            }

            // Cleans Garbage Collector and releases all cached COM interfaces.
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();

            ///the lines below outputs created RFEM nodes in output parameter
            ///current funcionality does not use this
            ///it uses a custom class (written within this project) RfemNodeType to wrap the Dlubal.RFEM5.Node objects.
            return(rhinoPointArray);
        }