private void VisitCADDatum(CyPhy.CADDatum datum)
        {
            if (!visitedPorts.Contains(datum.ID))
            {
                visitedPorts.Add(datum.ID);

                bool parentIsComponent = (datum.ParentContainer is CyPhy.Component);
                bool isStart           = (datum.ID == startNodeID);


                if (!isStart && parentIsComponent)
                {
                    FoundConnectedNodes.Add(datum);
                }

                foreach (CyPhy.PortComposition conn in datum.SrcConnections.PortCompositionCollection)
                {
                    visitedConns.Add(conn.ID);
                    VisitCADDatum(conn.SrcEnds.CADDatum);
                }

                foreach (CyPhy.PortComposition conn in datum.DstConnections.PortCompositionCollection)
                {
                    visitedConns.Add(conn.ID);
                    VisitCADDatum(conn.DstEnds.CADDatum);
                }
            }
        }
Exemple #2
0
        public Datum(CyPhy.CADDatum datum,
                     string compid, bool guide)
        {
            DatumName = datum.Attributes.DatumName;
            if (datum.Kind == "CoordinateSystem")
            {
                Type = DatumType.CSYS;
            }
            else if (datum.Kind == "Point")
            {
                Type = DatumType.Point;
            }
            else if (datum.Kind == "Surface")
            {
                Type = DatumType.Surface;
            }
            else if (datum.Kind == "Axis")
            {
                Type = DatumType.Axis;
            }

            ComponentID = compid;
            DatumID     = datum.ID;
            Guide       = guide;
            if (!String.IsNullOrEmpty(datum.Attributes.GeometricMarker))
            {
                Marker = new GeometryMarkerRep(datum.Attributes.GeometricMarker);
            }
        }
        public CadDatumTraversal(CyPhy.CADDatum datum, string cadmodelID)
        {
            datumFound   = new List <CyPhy.CADDatum>();
            visitedItems = new List <string>();
            ReverseMap   = false;
            CadModelID   = cadmodelID;
            DatumKind    = datum.Kind;

            VisitCadDatum(datum);
        }
Exemple #4
0
        public void PopulateStructuralInterface(CyPhy.CADDatum datum,
                                                CyPhy.CADModel acadmodel)
        {
            // META-947: Creates a virtual connector
            Dictionary <string, DataRep.Datum> featuremap = new Dictionary <string, DataRep.Datum>();

            FindMatchingDatums(datum,
                               acadmodel,
                               featuremap);

            this.DatumList     = featuremap;
            this.DegreeFreedom = GetDegreesOfFreedom();
        }
Exemple #5
0
        private void FindMatchingSolidModelingFeatures(CyPhy.CADDatum datum,
                                                       CyPhy.CADModel acadmodel)
        {
            // META-947: Creates a virtual connector
            DataRep.StructuralInterfaceConstraint sirep = new StructuralInterfaceConstraint(datum,
                                                                                            this.Id,
                                                                                            this.DisplayID);
            sirep.PopulateStructuralInterface(acadmodel);

            if (sirep.DatumList.Count > 0)
            {
                StructuralInterfaceNodes[datum.ID] = sirep;
            }
        }
        private void VisitCadDatum(CyPhy.CADDatum datum_1)
        {
            if (!visitedItems.Contains(datum_1.ID))
            {
                visitedItems.Add(datum_1.ID);

                List <CyPhy.CADDatum> caddatum_list = new List <CyPhy.CADDatum>();
                foreach (CyPhy.PortComposition conn in datum_1.SrcConnections.PortCompositionCollection)
                {
                    caddatum_list.Add(conn.SrcEnds.CADDatum);
                }

                foreach (CyPhy.PortComposition conn in datum_1.DstConnections.PortCompositionCollection)
                {
                    caddatum_list.Add(conn.DstEnds.CADDatum);
                }

                if (datum_1.Kind == "Surface")
                {
                    foreach (CyPhy.SurfaceReverseMap conn in (datum_1 as CyPhy.Surface).SrcConnections.SurfaceReverseMapCollection)
                    {
                        ReverseMap = true;
                        caddatum_list.Add(conn.SrcEnds.Surface);
                    }

                    foreach (CyPhy.SurfaceReverseMap conn in (datum_1 as CyPhy.Surface).DstConnections.SurfaceReverseMapCollection)
                    {
                        ReverseMap = true;
                        caddatum_list.Add(conn.DstEnds.Surface);
                    }
                }

                foreach (CyPhy.CADDatum datum_2 in caddatum_list)
                {
                    if (datum_2.ParentContainer.ID == CadModelID)
                    {
                        if (datum_2.Kind == DatumKind)
                        {
                            datumFound.Add(datum_2);
                        }
                    }
                }
            }
        }
Exemple #7
0
 private bool IsLimitRef(CyPhy.CADDatum datum)
 {
     return(datum is CyPhy.Surface &&
            ((datum as CyPhy.Surface).SrcConnections.KinematicRotationalLimitReferenceCollection.Any() ||
             (datum as CyPhy.Surface).SrcConnections.KinematicTranslationalLimitReferenceCollection.Any()));
 }
Exemple #8
0
        private bool FindMatchingDatums(CyPhy.CADDatum datum,
                                        CyPhy.CADModel cadmodel,
                                        Dictionary <string, DataRep.Datum> featuremap)
        {
            string cadmodel_id = cadmodel.ID;
            string alignment   = "ALIGN";
            string orientation = "NONE";


            if (datum.Kind == "Surface")
            {
                alignment = (datum as CyPhy.Surface).Attributes.Alignment.ToString();
                if (alignment == "MATE")
                {
                    Logger.Instance.AddLogMessage("MATE alignment is used on surface: " + datum.ToHyperLink() + ". This construct is obsolete, please set up the connection as ALIGN.", Severity.Warning);
                }
            }

            CadDatumTraversal traversal = new CadDatumTraversal(datum,
                                                                cadmodel_id);

            if (traversal.datumFound.Count > 0)
            {
                if (traversal.datumFound.Count > 1)
                {
                    Logger.Instance.AddLogMessage("Connector datum connected to multiple datums in the same CADModel [" + datum.Path + "]", Severity.Error);
                    return(true); // Error
                }

                // META-3232

                /*
                 * DataRep.Datum datumRep = new DataRep.Datum(traversal.datumFound.First().Attributes.DatumName,
                 *                                         datum.Kind,
                 *                                         this.ParentInstanceGUID, guide);
                 */
                bool guide = datum.Attributes.DefinitionNotes.Contains("GUIDE");
                if (guide)
                {
                    Logger.Instance.AddLogMessage("Datum is using old guide format. Please use the attribute 'IsGuide'. [" + datum.Path + "]", Severity.Error);
                    return(true); // Error
                }
                guide |= datum.Attributes.IsGuide;
                DataRep.Datum datumRep = new DataRep.Datum(traversal.datumFound.First(),
                                                           this.ParentInstanceGUID, guide);

                if (datum.Kind == "Surface")
                {
                    if (traversal.ReverseMap)
                    {
                        orientation = "SIDE_B";
                    }
                    else
                    {
                        orientation = "SIDE_A";
                    }
                }

                if (datum.Kind == "CoordinateSystem")
                {
                    alignment = "CSYS";
                }

                datumRep.Alignment   = alignment;
                datumRep.Orientation = orientation;

                if (!featuremap.ContainsKey(datum.Name))
                {
                    featuremap[datum.Name] = datumRep;
                }
            }

            return(false);
        }