Exemple #1
0
        public void Preview(ISwPart part, Color color, bool selectable = false)
        {
            var opts = selectable
                ? swTempBodySelectOptions_e.swTempBodySelectable
                : swTempBodySelectOptions_e.swTempBodySelectOptionNone;

            Body.Display3(part.Model, ColorUtils.ToColorRef(color), (int)opts);
        }
        private void SetLengthProperties(ISwPart part)
        {
            var lengths = part.Tags.Pop <List <double> >(CUT_LIST_LENGTH_TRACKING_DEF_NAME);

            var sw = m_App.Sw;

            var cutListLengthTrackingId = sw.RegisterTrackingDefinition(CUT_LIST_LENGTH_TRACKING_DEF_NAME);

            foreach (ISwFeature feat in part.Features)
            {
                if (feat.Feature.GetTypeName2() == "CutListFolder")
                {
                    var bodyFolderFeat = feat.Feature.GetSpecificFeature2() as IBodyFolder;
                    var bodies         = bodyFolderFeat.GetBodies() as object[];

                    if (bodies != null)
                    {
                        foreach (IBody2 body in bodies)
                        {
                            object trackingIds;
                            body.GetTrackingIDs(cutListLengthTrackingId, out trackingIds);

                            if (trackingIds is int[])
                            {
                                var index  = (trackingIds as int[]).First();
                                var length = lengths[index];

                                var userUnit = part.Model.IGetUserUnit((int)swUserUnitsType_e.swLengthUnit);
                                length = length * userUnit.GetConversionFactor();

                                feat.Feature.CustomPropertyManager.Add3(LENGTH_PRP_NAME,
                                                                        (int)swCustomInfoType_e.swCustomInfoDouble,
                                                                        length.ToString(),
                                                                        (int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);
                            }
                        }
                    }
                }
                else if (feat.Feature.GetTypeName2() == "RefPlane")
                {
                    break;
                }
            }
        }
Exemple #3
0
 internal CutListRebuildEventsHandler(SwPart part, ISwApplication app) : base(part, app)
 {
     m_Part = part;
 }
 internal CutListRebuildEventsHandler(ISwPart part) : base(part)
 {
     m_Part = part;
 }