public void RemoveTrimLine()
        {
            EnableUpdate = false;

            trimLine = null;
            TrimlineSourceOp.ReplaceSource(null);
        }
Example #2
0
        public static SceneObject BuildTrimLoopSO(SOFactory factory, FScene scene, TypedAttribSet attributes)
        {
            TrimLoopSO so = new TrimLoopSO();

            so.Create(scene.DefaultCurveSOMaterial);
            factory.RestorePolyCurveSOType(scene, attributes, so);
            return(so);
        }
Example #3
0
        public static bool EmitTrimLoopSO(SceneSerializer s, IOutputStream o, SceneObject gso)
        {
            TrimLoopSO so = gso as TrimLoopSO;

            if (so == null)
            {
                throw new Exception("EmitTrimLoopSO: input so is not an TrimLoopSO!");
            }
            o.AddAttribute(IOStrings.ASOType, so.Type.identifier);
            SceneSerializerEmitTypesExt.EmitPolyCurveSO(s, o, so as PolyCurveSO);
            return(true);
        }
Example #4
0
        public static TrimLoopSO CreateFromPlane(DMeshSO TargetSO, Frame3f PlaneS, SOMaterial material, FScene scene, double fNormalOffset = 0.0f)
        {
            Frame3f PlaneO = SceneTransforms.SceneToObject(TargetSO, PlaneS);

            PlaneIntersectionCurves curves = new PlaneIntersectionCurves(TargetSO.Mesh, PlaneO, 1)
            {
                NormalOffset = fNormalOffset
            };

            curves.Compute();

            if (curves.Loops.Length != 1)
            {
                throw new Exception("TrimLoopSO.CreateFromPlane: got more than one cut loop?");
            }
            DCurve3 loop = curves.Loops[0];

            // map loop back into plane frame
            for (int i = 0; i < loop.VertexCount; ++i)
            {
                loop[i] = PlaneO.ToFrameP(loop[i]);
            }

            TrimLoopSO curveSO = new TrimLoopSO()
            {
                Curve = loop
            };

            curveSO.Create(material);
            Frame3f curveFrame = SceneTransforms.ObjectToScene(TargetSO, PlaneO);

            curveSO.SetLocalFrame(curveFrame, CoordSpace.ObjectCoords);

            scene.History.PushChange(
                new AddSOChange()
            {
                scene = scene, so = curveSO, bKeepWorldPosition = false
            });
            scene.History.PushInteractionCheckpoint();

            return(curveSO);
        }
Example #5
0
        public static TrimLoopSO CreateFromPreview(CurvePreview preview, SOMaterial material, FScene scene)
        {
            TrimLoopSO curveSO = (TrimLoopSO)preview.BuildSO(
                (curve) => {
                TrimLoopSO so = new TrimLoopSO()
                {
                    Curve = curve
                };
                so.Create(material);
                return(so);
            }, material, 1.0f);

            scene.History.PushChange(
                new AddSOChange()
            {
                scene = scene, so = curveSO, bKeepWorldPosition = false
            });
            scene.History.PushInteractionCheckpoint();

            return(curveSO);
        }
        public SocketModel(SocketSO Socket, LegModel leg, TrimLoopSO trimLineIn, ModelModes eMode) : base(Socket.Mesh, false)
        {
            socket = Socket;

            this.leg = leg;
            leg.SO.OnTransformModified += leg_transform_modified;

            this.trimLine = trimLineIn;

            LegSourceOp      = new ShapeModelOutputMeshSourceOp(leg);
            TrimlineSourceOp = new PolyCurveSOSourceOp(this.trimLine);

            if (eMode == ModelModes.Socket)
            {
                DeviceGenOp = new SocketGeneratorOp();
            }
            else
            {
                DeviceGenOp = new AFOGeneratorOp();
            }

            DeviceGenOp.MeshSource               = LegSourceOp;
            DeviceGenOp.CurveSource              = TrimlineSourceOp;
            DeviceGenOp.SocketVertexColor        = Colorf.CornflowerBlue;
            DeviceGenOp.PartialSocketVertexColor = ColorMixer.Darken(Colorf.SelectionGold, 0.75f);
            DeviceGenOp.SocketThickness          = this.SocketThickness;
            DeviceGenOp.InnerWallOffset          = this.SocketOffset;
            DeviceGenOp.ConnectorCutHeight       = this.ConnectorCutHeight;

            Compute = new ThreadedMeshComputeOp()
            {
                MeshSource = DeviceGenOp
            };

            // initialize socket input transform
            leg_transform_modified(leg.SO);
        }
Example #7
0
        public override PolyCurveSO Create(SOMaterial defaultMaterial)
        {
            TrimLoopSO so = (TrimLoopSO)base.Create(defaultMaterial);

            return(so);
        }
 public void Disconnect()
 {
     trimLine = null;
 }
 public void SetNewTrimLine(TrimLoopSO so)
 {
     trimLine = so;
     TrimlineSourceOp.ReplaceSource(so);
 }