public static void Generate(string pluginPath, out Image bmp, Size size, PicFilter filter)
        {
            // instantiate factory
            PicFactory factory = new PicFactory();

            factory.Clear();

            // instantiate plugin
            Pic.Plugin.PluginServices pluginHost = new Pic.Plugin.PluginServices(pluginPath);
            IPlugin plugin = pluginHost.GetFirstPlugin();

            // generate entities
            ParameterStack stack = plugin.Parameters;

            plugin.CreateFactoryEntities(factory, stack);

            // get bounding box
            PicVisitorBoundingBox visitor = new PicVisitorBoundingBox();

            factory.ProcessVisitor(visitor);

            // draw image
            PicGraphicsImage picImage = new PicGraphicsImage();

            picImage.ImageSize = size;
            PicBox2D box = visitor.Box;

            box.AddMarginRatio(0.05);
            picImage.DrawingBox = box;
            factory.Draw(picImage, filter);

            bmp = picImage.Bitmap;
        }
Beispiel #2
0
        public Vector2D ImpositionOffset(ParameterStack stackIn)
        {
            var stack = ConvertIn(stackIn);

            if (null != _ext1)
            {
                return(new Vector2D(_ext1.ImpositionOffsetX(stack), _ext1.ImpositionOffsetY(stack)));
            }
            else if (null != _ext2)
            {
                return(new Vector2D(_ext2.ImpositionOffsetX(stack), _ext2.ImpositionOffsetY(stack)));
            }
            else if (null != _ext3)
            {
                return(new Vector2D(_ext3.ImpositionOffsetX(stack), _ext3.ImpositionOffsetY(stack)));
            }
            else if (null != _ext3)
            {
                return(new Vector2D(_ext4.ImpositionOffsetX(stack), _ext4.ImpositionOffsetY(stack)));
            }
            else
            {
                return(Vector2D.Zero);
            }
        }
Beispiel #3
0
        public Sharp3D.Math.Core.Vector2D ReferencePoint(ParameterStack stack)
        {
            List <Vector2D> l = null;

            if (null != _ext2)
            {
                l = _ext2.ReferencePoints(stack);
            }
            else if (null != _ext3)
            {
                l = _ext3.ReferencePoints(stack);
            }
            if (null == l)
            {
                return(Vector2D.Zero);
            }
            else if (l.Count > 0)
            {
                return(l[0]);
            }
            else
            {
                return(Vector2D.Zero);
            }
        }
Beispiel #4
0
        public Vector2D ReferencePoint(ParameterStack stackIn)
        {
            var             stack = ConvertIn(stackIn);
            List <Vector2D> l     = null;

            if (null != _ext2)
            {
                l = _ext2.ReferencePoints(stack);
            }
            else if (null != _ext3)
            {
                l = _ext3.ReferencePoints(stack);
            }
            if (null == l)
            {
                return(Vector2D.Zero);
            }
            else if (l.Count > 0)
            {
                return(l[0]);
            }
            else
            {
                return(Vector2D.Zero);
            }
        }
Beispiel #5
0
        public void GenerateImage(Size size, ParameterStack stack, out Image bmp)
        {
            // check if plugin was instantiated
            if (null == Component)
            {
                throw new Exception("No valid plugin instance loaded!");
            }

            // instantiate factory
            PicFactory factory = new PicFactory();

            // generate entities
            Component.CreateFactoryEntities(factory, stack);
            // apply any needed transformation
            if (ReflexionX)
            {
                factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
            }
            if (ReflexionY)
            {
                factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
            }
            // draw image
            PicGraphicsImage picImage = new PicGraphicsImage(size, Factory2D.Tools.BoundingBox(factory, 0.05));

            factory.Draw(picImage, ShowCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation);

            bmp = picImage.Bitmap;
        }
Beispiel #6
0
        public void GenerateImage(Size size, ParameterStack stack, out Image bmp)
        {
            // check if plugin was instantiated
            if (null == _component)
            {
                throw new Exception("No valid plugin instance loaded!");
            }

            // instantiate factory
            PicFactory factory = new PicFactory();

            // generate entities
            _component.CreateFactoryEntities(factory, stack);
            // apply any needed transformation
            if (_reflexionX)
            {
                factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
            }
            if (_reflexionY)
            {
                factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
            }
            // get bounding box
            PicVisitorBoundingBox visitor = new PicVisitorBoundingBox();

            factory.ProcessVisitor(visitor);
            Pic.Factory2D.Box2D box = visitor.Box;
            box.AddMarginRatio(0.05);
            // draw image
            PicGraphicsImage picImage = new PicGraphicsImage(size, box);

            factory.Draw(picImage, _showCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation);

            bmp = picImage.Bitmap;
        }
Beispiel #7
0
 public void Dimensions(ParameterStack stack, out double width, out double height, out double lengthCut, out double lengthFold)
 {
     // build factory
     Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory();
     _component.CreateFactoryEntities(factory, stack);
     if (_reflexionX)
     {
         factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
     }
     if (_reflexionY)
     {
         factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
     }
     // get bounding box
     Pic.Factory2D.PicVisitorBoundingBox visitorBoundingBox = new Pic.Factory2D.PicVisitorBoundingBox();
     factory.ProcessVisitor(visitorBoundingBox, _showCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation);
     Pic.Factory2D.Box2D box = visitorBoundingBox.Box;
     width  = box.Width;
     height = box.Height;
     // get length
     Pic.Factory2D.PicVisitorDieCutLength visitorLength = new Pic.Factory2D.PicVisitorDieCutLength();
     factory.ProcessVisitor(visitorLength, PicFilter.FilterNone);
     lengthCut  = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CUT) ? visitorLength.Lengths[PicGraphics.LT.LT_CUT] : 0.0;
     lengthFold = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitorLength.Lengths[PicGraphics.LT.LT_CREASING] : 0.0;
 }
Beispiel #8
0
        public byte[] GenerateImage(Size size, ParameterStack stack, ImageFormat format)
        {
            GenerateImage(size, stack, out Image bmp);
            MemoryStream ms = new MemoryStream();

            bmp.Save(ms, format);
            return(ms.GetBuffer());
        }
Beispiel #9
0
 public bool GetFlatDimensions(ParameterStack stack, ref double length, ref double width, ref double height)
 {
     if (null != _ext3 && _ext3.IsSupportingFlatPalletization)
     {
         _ext3.FlatDimensions(ConvertIn(stack), out double[] dim);
         length = ConvertOut(dim[0]); width = ConvertOut(dim[1]); height = ConvertOut(dim[2]);
         return(true);
     }
     return(false);
 }
Beispiel #10
0
        public ParameterStack Clone()
        {
            ParameterStack stackCopy = new ParameterStack();

            foreach (Parameter p in ParameterList)
            {
                stackCopy.AddParameter(p.Clone());
            }
            return(stackCopy);
        }
Beispiel #11
0
        /// <summary>
        /// Try to get outer dimensions to use for palletisation
        /// </summary>
        /// <param name="stack">Parameter stack</param>
        /// <param name="length">Length</param>
        /// <param name="width">Width</param>
        /// <param name="height">Height</param>
        /// <returns>true if a valid set of dimensions could be retrieved</returns>
        public bool GetDimensions(ParameterStack stack, ref double length, ref double width, ref double height)
        {
            if (null != _ext1)
            {
                // search three parameters A/L, B, H
                bool foundL = false, foundW = false, foundH = false;
                foreach (Pic.Plugin.Parameter param in stack)
                {
                    ParameterDouble paramDouble = param as ParameterDouble;
                    if (null == paramDouble)
                    {
                        continue;
                    }

                    if (0 == string.Compare(paramDouble.Name.ToLower(), "a") || 0 == string.Compare(paramDouble.Name.ToLower(), "l"))
                    {
                        foundL = true;
                        length = paramDouble.Value;
                    }
                    else if (0 == string.Compare(paramDouble.Name.ToLower(), "b"))
                    {
                        foundW = true;
                        width  = paramDouble.Value;
                    }
                    else if (0 == string.Compare(paramDouble.Name.ToLower(), "h"))
                    {
                        foundH = true;
                        height = paramDouble.Value;
                    }
                }
                // to support palletization, all three parameters must be found
                return(foundL && foundW && foundH);
            }
            else if (null != _ext2)
            {
                if (_ext2.IsSupportingPalletization)
                {
                    double[] dim;
                    _ext2.OuterDimensions(stack, out dim);
                    length = dim[0]; width = dim[1]; height = dim[2];
                    return(true);
                }
            }
            else if (null != _ext3)
            {
                if (_ext3.IsSupportingPalletization)
                {
                    double[] dim;
                    _ext3.OuterDimensions(stack, out dim);
                    length = dim[0]; width = dim[1]; height = dim[2];
                    return(true);
                }
            }
            return(false);
        }
Beispiel #12
0
        public byte[] GenerateExportFile(string fileFormat, ParameterStack stack)
        {
            // build factory
            Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory();
            _component.CreateFactoryEntities(factory, stack);
            if (_reflexionX)
            {
                factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
            }
            if (_reflexionY)
            {
                factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
            }

            // instantiate filter
            PicFilter filter = (_showCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation) & PicFilter.FilterNoZeroEntities;

            // get bounding box
            Pic.Factory2D.PicVisitorBoundingBox visitorBoundingBox = new Pic.Factory2D.PicVisitorBoundingBox();
            factory.ProcessVisitor(visitorBoundingBox, filter);
            Pic.Factory2D.Box2D box = visitorBoundingBox.Box;
            // add margins : 5 % of the smallest value among height
            box.AddMarginHorizontal(box.Width * 0.05);
            box.AddMarginVertical(box.Height * 0.05);
            // get file content
            if ("des" == fileFormat)
            {
                Pic.Factory2D.PicVisitorDesOutput visitor = new Pic.Factory2D.PicVisitorDesOutput();
                visitor.Author = "treeDiM";
                // process visitor
                factory.ProcessVisitor(visitor, filter);
                return(visitor.GetResultByteArray());
            }
            else if ("dxf" == fileFormat)
            {
                Pic.Factory2D.PicVisitorOutput visitor = new Pic.Factory2D.PicVisitorDxfOutput();
                visitor.Author = "treeDiM";
                // process visitor
                factory.ProcessVisitor(visitor, filter);
                return(visitor.GetResultByteArray());
            }
            else if ("pdf" == fileFormat)
            {
                PicGraphicsPdf graphics = new PicGraphicsPdf(box);
                graphics.Author = "treeDiM";
                graphics.Title  = "Pdf Export";
                // draw
                factory.Draw(graphics, filter);
                return(graphics.GetResultByteArray());
            }
            else
            {
                throw new Exception("Invalid file format : " + fileFormat);
            }
        }
Beispiel #13
0
 public bool GetFlatDimensions(ParameterStack stack, ref double length, ref double width, ref double height)
 {
     if (null != _ext3 && _ext3.IsSupportingFlatPalletization)
     {
         double[] dim;
         _ext3.FlatDimensions(stack, out dim);
         length = dim[0]; width = dim[1]; height = dim[2];
         return(true);
     }
     return(false);
 }
Beispiel #14
0
        /// <summary>
        /// Build parameter stack
        /// IPluginExt1 simply returns a static list of parameters or the same current list
        /// IpluginExt2 builds a new list depending on the current list state
        /// </summary>
        public ParameterStack BuildParameterStack(ParameterStack stackIn1)
        {
            ParameterStack stackIn = (null != stackIn1) ? ConvertIn(stackIn1) : null;
            ParameterStack stackOut;

            if (null != _ext1)
            {
                if (null != stackIn && stackIn.Count > 0)
                {
                    stackOut = stackIn;
                }
                else
                {
                    stackOut = Plugin.Parameters;
                }
            }
            else if (null != _ext2)
            {
                stackOut = _ext2.BuildParameterStack(stackIn);
            }
            else if (null != _ext3)
            {
                stackOut = _ext3.BuildParameterStack(stackIn);
            }
            else if (null != _ext4)
            {
                stackOut = _ext4.BuildParameterStack(stackIn);
            }
            else
            {
                stackOut = new ParameterStack();
            }

            // adding thickness parameters
            // these parameters are always available but are not shown in the list of parameters in the plugin viewer
            // ep1 and th1 are reserved name
            double defaultThickness = Host.Properties.Settings.Default.Thickness;

            if (!stackOut.HasParameter("th1"))
            {
                stackOut.AddDoubleParameter("th1", "Thickness"
                                            , null != stackIn && stackIn.HasParameter("th1") ? stackIn.GetDoubleParameterValue("th1") : defaultThickness);
            }
            if (!stackOut.HasParameter("ep1"))
            {
                stackOut.AddDoubleParameter("ep1", "Thickness"
                                            , null != stackIn && stackIn.HasParameter("ep1") ? stackIn.GetDoubleParameterValue("ep1") : defaultThickness);
            }

            return(ConvertOut(stackOut));
        }
Beispiel #15
0
        public string GetInsertionCode()
        {
            Pic.Plugin.ParameterStack stackIn = _component.BuildParameterStack(null);
            string csCode = string.Empty;

            csCode += "\n";
            csCode += "\t\t{ // " + _component.Name + "\n";
            csCode += "\t\t\tIPlugin pluginIn = Host.GetPluginByGuid(\"" + _component.Guid.ToString() + "\");\n";
            csCode += "\t\t\tParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn);\n";
            foreach (Parameter param in stackIn)
            {
                // double
                ParameterDouble paramDouble = param as ParameterDouble;
                if (null != paramDouble)
                {
                    csCode += "\t\t\tstackIn.SetDoubleParameter(\"" + paramDouble.Name + "\"," + paramDouble.ValueDefault.ToString() + ");\t\t// " + paramDouble.Description + "\n";
                }

                // bool
                ParameterBool paramBool = param as ParameterBool;
                if (null != paramBool)
                {
                    csCode += "\t\t\tstackIn.SetBoolParameter(\"" + paramBool.Name + "\"," + (paramBool.ValueDefault ? "true" : "false") + ");\t\t// " + paramBool.Description + "\n";
                }

                // int
                ParameterInt paramInt = param as ParameterInt;
                if (null != paramInt)
                {
                    csCode += "\t\t\tstackIn.SetIntParameter(\"" + paramInt.Name + "\"," + paramInt.ValueDefault.ToString() + ");\t\t// " + paramInt.Description + "\n";
                }

                // multi
                ParameterMulti paramMulti = param as ParameterMulti;
                if (null != paramMulti)
                {
                    csCode += "\t\t\tstackIn.SetMultiParameter(\"" + paramMulti.Name + "\"," + paramMulti.Value.ToString() + ");\t\t// " + paramMulti.Description + "\n";
                }
            }
            csCode += "\t\t\tbool reflectionX = false, reflectionY = false;\n";
            csCode += "\t\t\tTransform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity);\n";
            csCode += "\t\t\tpluginIn.CreateFactoryEntities(fTemp, stackIn,\n";
            csCode += "\t\t\t\t Transform2D.Translation(new Vector2D(0.0, 0.0))\n";
            csCode += "\t\t\t\t *Transform2D.Rotation(0.0)\n";
            csCode += "\t\t\t\t *transfReflect);\n";
            csCode += "\t\t}\n";
            return(csCode);
        }
Beispiel #16
0
        public List <Guid> GetDependancies(ParameterStack stack)
        {
            // clear list of dependancies
            _dependancyList.Clear();
            // instanciate handler of ComponentLoader.OnPluginAccessed
            ComponentLoader.PluginAccessed handler = new ComponentLoader.PluginAccessed(OnGuidLoaded);
            ComponentLoader.OnPluginAccessed += handler;
            // instantiate factory
            PicFactory factory = new PicFactory();

            _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity);
            // on plugin accessed
            ComponentLoader.OnPluginAccessed -= handler;
            // dependancy list
            return(_dependancyList);
        }
Beispiel #17
0
        public ParameterStack GetParameters(IComponentSearchMethod compSearchMethod)
        {
            ParameterStack parameters = Plugin.Parameters;
            string         grpId      = string.Empty;

            if (null != compSearchMethod)
            {
                foreach (Parameter p in parameters)
                {
                    try
                    {
                        if (p is ParameterAngle pa)
                        {
                            parameters.SetAngleParameter(pa.Name, compSearchMethod.GetAngleParameterDefaultValue(grpId, Guid, pa.Name));
                        }
                        if (p is ParameterDouble pd)
                        {
                            parameters.SetDoubleParameter(pd.Name, compSearchMethod.GetDoubleParameterDefaultValue(grpId, Guid, pd.Name));
                        }
                        if (p is ParameterBool pb)
                        {
                            parameters.SetBoolParameter(pb.Name, compSearchMethod.GetBoolParameterDefaultValue(grpId, Guid, pb.Name));
                        }
                        if (p is ParameterInt pi)
                        {
                            parameters.SetIntegerParameter(pi.Name, compSearchMethod.GetIntParameterDefaultValue(grpId, Guid, pi.Name));
                        }
                        if (p is ParameterMulti pm)
                        {
                            parameters.SetMultiParameter(pm.Name, 0);
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
            }
            return(parameters);
        }
Beispiel #18
0
        public ParameterStack GetParameters(IComponentSearchMethod compSearchMethod)
        {
            ParameterStack parameters = _instance.Parameters;

            if (null != compSearchMethod)
            {
                foreach (Parameter p in parameters)
                {
                    try
                    {
                        ParameterDouble pd = p as ParameterDouble;
                        if (null != pd)
                        {
                            parameters.SetDoubleParameter(pd.Name, compSearchMethod.GetDoubleParameterDefaultValue(Guid, pd.Name));
                        }
                        ParameterBool pb = p as ParameterBool;
                        if (null != pb)
                        {
                            parameters.SetBoolParameter(pb.Name, compSearchMethod.GetBoolParameterDefaultValue(Guid, pb.Name));
                        }
                        ParameterInt pi = p as ParameterInt;
                        if (null != pi)
                        {
                            parameters.SetIntegerParameter(pb.Name, compSearchMethod.GetIntParameterDefaultValue(Guid, pi.Name));
                        }
                        ParameterMulti pm = p as ParameterMulti;
                        if (null != pm)
                        {
                            parameters.SetMultiParameter(pm.Name, 0);
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
            }
            return(parameters);
        }
Beispiel #19
0
        /// <summary>
        /// Creates factory entities (mostly segment, arcs, cotations...) in <see cref="PicFactory"/> class instance passed as first argument
        /// </summary>
        /// <param name="factory">Instance of class <see cref="PicFactory"/> to be populated with entities</param>
        /// <param name="stack">Array of <see cref="Paramerter"/> to apply while generating entities</param>
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stackIn)
        {
            ParameterStack stack    = ConvertIn(stackIn);
            var            tempList = new List <string>(MessageList);

            MessageList.Clear();
            var handler = new ComponentLoader.FeedbackEmitted(OnFeedbackAdded);

            ComponentLoader.OnFeedbackEmitted += handler;
            Plugin.CreateFactoryEntities(factory, stack, Transform2D.Identity);

            // --- US units ---
            stackIn = ConvertOut(stack);
            ConvertOutRef(factory);
            // ---

            ComponentLoader.OnFeedbackEmitted -= handler;

            if (!MessageList.SequenceEqual(tempList))
            {
                FeedBack?.Invoke(this, MessageList);
            }
        }
Beispiel #20
0
 public List<Guid> GetDependancies(ParameterStack stack)
 {
     // clear list of dependancies
     _dependancyList.Clear();
     // instanciate handler of ComponentLoader.OnPluginAccessed
     ComponentLoader.PluginAccessed handler = new ComponentLoader.PluginAccessed(OnGuidLoaded);
     ComponentLoader.OnPluginAccessed += handler;
     // instantiate factory
     PicFactory factory = new PicFactory();
     _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity);
     // on plugin accessed
     ComponentLoader.OnPluginAccessed -= handler; 
     // dependancy list
     return _dependancyList;
 }
Beispiel #21
0
 public void Dimensions(ParameterStack stack, out double width, out double height, out double lengthCut, out double lengthFold)
 { 
     // build factory
     Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory();
     _component.CreateFactoryEntities(factory, stack);
     if (_reflexionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
     if (_reflexionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
     // get bounding box
     Pic.Factory2D.PicVisitorBoundingBox visitorBoundingBox = new Pic.Factory2D.PicVisitorBoundingBox();
     factory.ProcessVisitor(visitorBoundingBox, _showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation);
     Pic.Factory2D.Box2D box = visitorBoundingBox.Box;
     width = box.Width;
     height = box.Height;
     // get length
     Pic.Factory2D.PicVisitorDieCutLength visitorLength = new Pic.Factory2D.PicVisitorDieCutLength();
     factory.ProcessVisitor(visitorLength, PicFilter.FilterNone);
     lengthCut = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CUT) ? visitorLength.Lengths[PicGraphics.LT.LT_CUT] : 0.0;
     lengthFold = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitorLength.Lengths[PicGraphics.LT.LT_CREASING] : 0.0;
 }
Beispiel #22
0
        public ParameterStack GetInitializedParameterStack(IPlugin plugin)
        {
            // check if already available in cache
            ParameterStack stack = null;

            stack = ComponentLoader.GetStackFromCache(plugin.Guid);
            if (null == stack)
            {
                if (!(_searchMethod is IComponentSearchMethod))
                {
                    throw new PluginException("Component loader was not initialized with a valid plugin search method.");
                }

                IPluginExt1 pluginExt1 = plugin as IPluginExt1;
                IPluginExt2 pluginExt2 = plugin as IPluginExt2;
                IPluginExt3 pluginExt3 = plugin as IPluginExt3;

                // get parameter stack
                if (null != pluginExt1)
                {
                    stack = plugin.Parameters;
                }
                else if (null != pluginExt2)
                {
                    stack = pluginExt2.BuildParameterStack(null);
                }
                else if (null != pluginExt3)
                {
                    stack = pluginExt3.BuildParameterStack(null);
                }
                // check parameter stack
                if (null == stack)
                {
                    throw new PluginException("Failed to build initial parameter stack.");
                }

                // load parameter values from plugins
                foreach (Parameter param in stack)
                {
                    try
                    {
                        ParameterDouble pd = param as ParameterDouble;
                        if (null != pd)
                        {
                            stack.SetDoubleParameter(pd.Name, _searchMethod.GetDoubleParameterDefaultValue(plugin.Guid, pd.Name));
                        }
                        ParameterBool pb = param as ParameterBool;
                        if (null != pb)
                        {
                            stack.SetBoolParameter(pb.Name, _searchMethod.GetBoolParameterDefaultValue(plugin.Guid, pb.Name));
                        }
                        ParameterInt pi = param as ParameterInt;
                        if (null != pi)
                        {
                            stack.SetIntParameter(pi.Name, _searchMethod.GetIntParameterDefaultValue(plugin.Guid, pi.Name));
                        }
                        ParameterMulti pm = param as ParameterMulti;
                        if (null != pm)
                        {
                            stack.SetMultiParameter(pm.Name, _searchMethod.GetMultiParameterDefaultValue(plugin.Guid, pm.Name));
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
                // save in cache
                ComponentLoader.InsertParameterStackInCache(plugin.Guid, stack);
            }
            return(stack.Clone());
        }
Beispiel #23
0
        /// <summary>
        /// Try to get outer dimensions to use for palletisation
        /// </summary>
        /// <param name="stack">Parameter stack</param>
        /// <param name="length">Length</param>
        /// <param name="width">Width</param>
        /// <param name="height">Height</param>
        /// <returns>true if a valid set of dimensions could be retrieved</returns>
        public bool GetDimensions(ParameterStack stack, ref double length, ref double width, ref double height)
        {
            if (null != _ext1)
            {
                // search three parameters A/L, B, H 
                bool foundL = false, foundW = false, foundH = false;
                foreach (Pic.Plugin.Parameter param in stack)
                {
                    ParameterDouble paramDouble = param as ParameterDouble;
                    if (null == paramDouble) continue;

                    if (0 == string.Compare(paramDouble.Name.ToLower(), "a") || 0 == string.Compare(paramDouble.Name.ToLower(), "l"))
                    {
                        foundL = true;
                        length = paramDouble.Value;
                    }
                    else if (0 == string.Compare(paramDouble.Name.ToLower(), "b"))
                    {
                        foundW = true;
                        width = paramDouble.Value;
                    }
                    else if (0 == string.Compare(paramDouble.Name.ToLower(), "h"))
                    {
                        foundH = true;
                        height = paramDouble.Value;
                    }
                }
                // to support palletization, all three parameters must be found
                return foundL && foundW && foundH;
            }
            else if (null != _ext2)
            {
                if (_ext2.IsSupportingPalletization)
                {
                    double[] dim;
                    _ext2.OuterDimensions(stack, out dim);
                    length = dim[0]; width = dim[1]; height = dim[2];
                    return true;
                }
            }
            else if (null != _ext3)
            {
                if (_ext3.IsSupportingPalletization)
                {
                    double[] dim;
                    _ext3.OuterDimensions(stack, out dim);
                    length = dim[0]; width = dim[1]; height = dim[2];
                    return true;
                }
            }
            return false; 
        }
Beispiel #24
0
 public byte[] GenerateImage(Size size, ParameterStack stack, ImageFormat format)
 {
     Image bmp;
     GenerateImage(size, stack, out bmp);
     MemoryStream ms = new MemoryStream();
     bmp.Save(ms, format);
     return ms.GetBuffer();
 }
        public FormEditMajorations(int compId, Profile currentProfile, ProfileLoader profileLoader)
        {
            InitializeComponent();

            _componentId   = compId;
            _profileLoader = profileLoader;

            if (!DesignMode)
            {
                // plugin viewer
                _pluginViewCtrl          = new PluginViewCtrl();
                _pluginViewCtrl.Size     = _pb.Size;
                _pluginViewCtrl.Location = _pb.Location;
                _pluginViewCtrl.Visible  = true;
                this.Controls.Add(_pluginViewCtrl);
                // hide
                _pb.Visible = false;
            }

            // fill combo box
            FillProfileComboBox(currentProfile.ToString());

            // get parameter stack
            Pic.Plugin.ParameterStack stack = null;
            using (Pic.Plugin.ComponentLoader loader = new Pic.Plugin.ComponentLoader())
            {
                PPDataContext            db        = new PPDataContext();
                Pic.DAL.SQLite.Component comp      = Pic.DAL.SQLite.Component.GetById(db, _componentId);
                Pic.Plugin.Component     component = loader.LoadComponent(comp.Document.File.Path(db));
                stack = component.BuildParameterStack(null);
                // load component in pluginviewer
                _pluginViewCtrl.Component = component;
            }

            // insert majoration label and textbox controls
            int lblX = 20, lblY = 60;
            int offsetX = 110, offsetY = 29;
            int tabIndex = bnCancel.TabIndex;
            int iCount   = 0;

            foreach (Parameter param in stack.ParameterList)
            {
                // only shows majorations
                if (!param.IsMajoration)
                {
                    continue;
                }
                ParameterDouble paramDouble = param as ParameterDouble;
                // create Label control
                Label lbl = new Label();
                lbl.Name     = string.Format("lbl_{0}", param.Name);
                lbl.Text     = param.Name;
                lbl.Location = new Point(
                    lblX + (iCount / 5) * offsetX
                    , lblY + (iCount % 5) * offsetY);
                lbl.Size     = new Size(30, 13);
                lbl.TabIndex = ++tabIndex;
                this.Controls.Add(lbl);
                // create NumericUpDown control
                NumericUpDown nud = new NumericUpDown();
                nud.Name          = string.Format("nud_{0}", param.Name);
                nud.Increment     = 0.1M;
                nud.Minimum       = paramDouble.HasValueMin ? (decimal)paramDouble.ValueMin : -10000.0M;
                nud.Maximum       = paramDouble.HasValueMax ? (decimal)paramDouble.ValueMax : 10000.0M;
                nud.DecimalPlaces = 1;
                nud.Value         = (decimal)paramDouble.Value;
                nud.Location      = new Point(
                    lblX + (iCount / 5) * offsetX + lbl.Size.Width + 1
                    , lblY + (iCount % 5) * offsetY);
                nud.Size          = new Size(60, 20);
                nud.TabIndex      = ++tabIndex;
                nud.ValueChanged += new EventHandler(nudValueChanged);
                nud.GotFocus     += new EventHandler(nud_GotFocus);
                nud.Click        += new EventHandler(nud_GotFocus);
                this.Controls.Add(nud);

                ++iCount;
            }

            UpdateMajorationValues();
        }
Beispiel #26
0
        /// <summary>
        /// Build parameter stack
		/// IPluginExt1 simply returns a static list of parameters or the same current list
		/// IpluginExt2 builds a new list depending on the current list state
        /// </summary>
        public ParameterStack BuildParameterStack(ParameterStack stackIn)
        {
            ParameterStack stackOut = null;
            if (null != _ext1)
			{
                if (null != stackIn)
                    stackOut = stackIn;
                else
                    stackOut = _instance.Parameters;
			}
            else if (null != _ext2)
                stackOut = _ext2.BuildParameterStack(stackIn);
            else  if (null != _ext3)
                stackOut = _ext3.BuildParameterStack(stackIn);
            else
                stackOut = new ParameterStack();


            // adding thickness parameters 
            // these parameters are always available but are not shown in the list of parameters in the plugin viewer
            // ep1 and th1 are reserved name
            double defaultThickness = Pic.Plugin.Host.Properties.Settings.Default.Thickness;
            if (!stackOut.HasParameter("ep1"))
                stackOut.AddDoubleParameter("ep1", "Epaisseur"
                    , null != stackIn && stackIn.HasParameter("ep1") ? stackIn.GetDoubleParameterValue("ep1") : defaultThickness);
            if (!stackOut.HasParameter("th1"))
                stackOut.AddDoubleParameter("th1", "Thickness"
                    , null != stackIn && stackIn.HasParameter("th1") ? stackIn.GetDoubleParameterValue("th1") : defaultThickness);

            return stackOut;
        }
Beispiel #27
0
 public Vector2D ImpositionOffset(ParameterStack stack)
 {
     if (null != _ext1)
         return new Vector2D(_ext1.ImpositionOffsetX(stack), _ext1.ImpositionOffsetY(stack));
     else if (null != _ext2)
         return new Vector2D(_ext2.ImpositionOffsetX(stack), _ext2.ImpositionOffsetY(stack));
     else if (null != _ext3)
         return new Vector2D(_ext3.ImpositionOffsetX(stack), _ext3.ImpositionOffsetY(stack));
     else
         return Vector2D.Zero;
 }
Beispiel #28
0
        /// <summary>
        /// Create factory entities
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="stack"></param>
        public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {

            // get parameter values
            double ParamX1 = stack.GetDoubleParameterValue("ParamX1");
            double L1 = stack.GetDoubleParameterValue("L1");
            double B1 = stack.GetDoubleParameterValue("B1");
            double L2 = stack.GetDoubleParameterValue("L2");
            double B2 = stack.GetDoubleParameterValue("B2");
            double H1 = stack.GetDoubleParameterValue("H1");
            double RL = stack.GetDoubleParameterValue("RL");
            double RB = stack.GetDoubleParameterValue("RB");
            double Xo = stack.GetDoubleParameterValue("Xo");
            double Yo = stack.GetDoubleParameterValue("Yo");
            double Diro = stack.GetDoubleParameterValue("Diro");
            bool Symy = stack.GetBoolParameterValue("Symy");

            double m15 = stack.GetDoubleParameterValue("m15");
            double m16 = stack.GetDoubleParameterValue("m16");
            double decalenc = stack.GetDoubleParameterValue("decalenc");
            double encoche = stack.GetDoubleParameterValue("encoche");

            int PoignsurTete = stack.GetIntParameterValue("PoignsurTete");

            bool caisse_en_2 = stack.GetBoolParameterValue("caisse_en_2");
            int caisse_en_4 = stack.GetIntParameterValue("caisse_en_4");

            double lgPatte = stack.GetDoubleParameterValue("lgPatte");

            IPlugin DemiPatteCol = stack.GetPluginParameterValue("DemiPatteCol");
            IPlugin Poignee = stack.GetPluginParameterValue("Poignee");


            double HY = 0.0;

            double ec1 = 0.0, ec2 = 0.0;
            CalEncoche(ref ec1, ref ec2, m15, m16, decalenc, encoche);

            if (caisse_en_2 || caisse_en_4 > 0)
            {
                B1 = B2;
                L2 = 0.0;
                B2 = 0.0;
            }
            if (caisse_en_4 == 1 || caisse_en_4 == 3)
            {
                B1 = 0.0;
                RB = RL;
                L2 = 0.0;
                B2 = 0.0;
            }
            if (caisse_en_4 == 2 || caisse_en_4 == 4)
            {
                L1 = B1;
                RL = RB;
                B1 = 0.0;
                L2 = 0.0;
                B2 = 0.0;
            }

            double PX1 = lgPatte;
            double PX2 = L1;
            double PX3 = B1;
            double PX4 = L2;
            double PX5 = B2;

            double RBY1 = 0.0, RBY2 = 0.0, RBY3 = 0.0, RBY4 = 0.0, RBY5 = 0.0;
            double RHY1 = 0.0, RHY2 = 0.0, RHY3 = 0.0, RHY4 = 0.0, RHY5 = 0.0;
            double patProlong = 0.0;
            if (Symy)
            {
                RBY1 = patProlong;
                RBY2 = RL;
                RBY3 = RB;
                RBY4 = RL;
                RBY5 = RB;
            }
            else
            {
                RHY1 = patProlong;
                RHY2 = RL;
                RHY3 = RB;
                RHY4 = RL;
                RHY5 = RB;
            }
            HY = HY + H1;

            if (caisse_en_2 || caisse_en_4 > 0)
            {
                if (PX5 != 0)
                    PX3 = PX5;
                PX4 = 0;
                PX5 = 0;
                RHY4 = 0;
                RHY5 = 0;
                RBY4 = 0;
                RBY5 = 0;
            }

            double V0 = 0.0;
            double v1 = V0 + lgPatte;
            double v2 = v1 + L1;
            double v3 = v2 + B1;
            double v4 = v3 + L2;
            double V5 = v4 + B2;
            double V6 = H1;
            double w0 = 0.0;
            double w1 = V6 + RL;
            double w2 = V6 + RB;
            double w3 = V6 + RL;
            double w4 = V6 + RB;

            SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>();
            PicFactory fTemp = new PicFactory();

            // segments
            double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0;
            uint index = 0;
            const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT;
            const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING;

            if (3 == caisse_en_4)
            {
                x1 = v1;
                y1 = V6;
                x2 = v2;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                x1 = v1;
                y1 = w0;
                x2 = x1;
                y2 = w2;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                x1 = x2;
                y1 = y2;
                x2 = v2;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                x1 = x2;
                y1 = y2;
                x2 = x1;
                y2 = w0;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
            }
            else
            {
                x1 = v1;
                y1 = w0;
                x2 = x1;
                y2 = V6;
                entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                x1 = v2;
                y1 = w0;
                x2 = x1;
                y2 = V6;

                if (!caisse_en_2 && 0 == caisse_en_4)
                {
                    entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                    x1 = v3;
                    y1 = w0;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                    x1 = v4;
                    y1 = w0;
                    x2 = x1;
                    y2 = V6;
                }
                if (0 == caisse_en_4)
                {
                    entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));
                    x1 = v1 + ec2;
                    y1 = V6;
                    x2 = v2 - ec2;
                }
                else
                {
                    x1 = v1 + ec2;
                    y1 = V6;
                    if (caisse_en_4 == 4)
                        x2 = v2 - ec2;
                    else
                        x2 = v2;
                }
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2));

                if (caisse_en_4 == 4)
                {
                    x1 = x2;
                    y1 = y2;
                    x2 = x1 + ec1;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }
                x1 = v2 + ec1;
                y1 = V6;
                if (!caisse_en_2 && caisse_en_4 == 0)
                    x2 = v3 - ec1;
                else
                    x2 = v3;
                y2 = y1;
                if (caisse_en_4 == 0)
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                if (!caisse_en_2 && caisse_en_4 == 0)
                {
                    // 9
                    x1 = v3 + ec2;
                    y1 = V6;
                    x2 = v4 - ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 10
                    x1 = v4 + ec1;
                    y1 = V6;
                    x2 = V5;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }


                // 11
                if (!caisse_en_2 && caisse_en_4 == 0)
                    x1 = V5;
                else
                {
                    if (caisse_en_4 == 0)
                        x1 = v3;
                    else
                        x1 = v2;
                }
                y1 = w0;
                x2 = x1;
                if (caisse_en_4 == 4)
                    y2 = V6;
                else
                    y2 = w4;
                entities.Add(++index, fTemp.AddSegment(caisse_en_4 == 4 ? ltFold : ltCut, 1, 1, x1, y1, x2, y2));

                if (caisse_en_4 == 4)
                {
                    x1 = x1 - ec1;
                    x2 = x1;
                    y1 = y2;
                    y2 = w4;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }

                if (!caisse_en_2 && caisse_en_4 == 0)
                {
                    // 12
                    x1 = x2;
                    y1 = y2;
                    x2 = v4 + ec1;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 13
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 14
                    x1 = x2;
                    y1 = y2;
                    x2 = v4 - ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 15
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = w3;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 16
                    x1 = x2;
                    y1 = y2;
                    x2 = v3 + ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 17
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 18
                    x1 = x2;
                    y1 = y2;
                    x2 = v3 - ec1;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                    // 19
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = w2;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                }

                // 20
                x1 = x2;
                y1 = y2;
                y2 = y1;
                if (caisse_en_4 == 0)
                {
                    x2 = v2 + ec1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 21
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = V6;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 22
                    x1 = x2;
                    y1 = y2;
                    x2 = v2 - ec2;
                    y2 = y1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 23
                    x1 = x2;
                    y1 = y2;
                    x2 = x1;
                    y2 = w1;
                    entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));
                    // 24
                }
                else
                {
                    if (caisse_en_4 != 4)
                        x2 = v2;
                }

                x1 = x2;
                y1 = y2;
                x2 = v1 + ec2;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                // 25
                x1 = x2;
                y1 = y2;
                x2 = x1;
                y2 = V6;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                // 26
                x1 = x2;
                y1 = y2;
                x2 = v1;
                y2 = y1;
                entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2));

                // Patte de Collage
                ParameterStack stackDemiPatteCol = DemiPatteCol.Parameters;
                if (caisse_en_4 != 3)
                {

                    //Call DemiPatteCol(ParamX1, lgPatte, H1, ec1, anglPc, patProlong, 0#, 0#, 0#, False)
                    DemiPatteCol.CreateFactoryEntities(fTemp, stackDemiPatteCol, transform);
                }
                if (caisse_en_4 == 4)
                {
                    // Call DemiPatteCol(ParamX1, lgPatte, H1, ec1, anglPc, patProlong, L1 + 2 * lgPatte, 0#, 180, True)
                    DemiPatteCol.CreateFactoryEntities(fTemp, stackDemiPatteCol, transform);
                }
            }

            if ((!Symy && PoignsurTete > 0) && caisse_en_4 == 0)
            {
                if (L1 < B1)
                {
                    v1 = lgPatte + L1 / 2.0;
                    v2 = lgPatte + L1 + B1 + L2 / 2.0;
                }
                else
                {
                    v1 = lgPatte + L1 + B1 / 2.0;
                    v2 = lgPatte + L1 + B1 + L2 + B2 / 2.0;
                }
                // ParamX1, v1, H1, 0, False
                ParameterStack stackPoignee = Poignee.Parameters;
                stackPoignee.SetDoubleParameter("", v1);
                stackPoignee.SetDoubleParameter("", H1);
                stackPoignee.SetDoubleParameter("", 0);
                stackPoignee.SetBoolParameter("", false);
                Poignee.CreateFactoryEntities(fTemp, stackPoignee, transform);

                //(ParamX1, v2, H1, 0, False)
                if (!caisse_en_2)
                    Poignee.CreateFactoryEntities(fTemp, stackPoignee, transform);
            }

            factory.AddEntities(fTemp, transform);
/*
            int hom = 0;
            if (Symy)
                hom = -1;
            else
                hom = 1;
            //ParamX1.Tranf2d Index(index1), Index(idxcour), Xo, Yo, Diro, hom
*/ 
        }
Beispiel #29
0
        public void SetParameterValue(string paramName, double paramValue)
        {
            if (null == _paramStackCurrent)
               _paramStackCurrent = Component.BuildParameterStack(_paramStackCurrent);
            _paramStackCurrent.SetDoubleParameter(paramName, paramValue);

            _picGraphics.DrawingBox = BoundingBox;
            FitView();
        }
Beispiel #30
0
        void _timer_Tick(object sender, EventArgs e)
        {
            ++_timerStep;
            if (_timerStep < _noStepsTimer)
            {
                double parameterValue = 0;
                int iStep = _timerStep < _noStepsTimer / 2 ? _timerStep : _noStepsTimer - 1 - _timerStep;
                if (_parameterInitialValue > 10)
                    parameterValue = _parameterInitialValue + iStep * 0.1 * _parameterInitialValue;
                else if (_parameterInitialValue <= 10)
                    parameterValue = _parameterInitialValue + iStep * 2;

                tempParameterStack.SetDoubleParameter(_parameterName, parameterValue);
                _computeBbox = false;
                Panel1.Invalidate();
            }
            else
            {   // reset original parameter stack + stop timer
                tempParameterStack = null;
                timer.Stop();
                // redraw a last timer
                Panel1.Invalidate();
            }
        }
Beispiel #31
0
        public ParameterStack GetInitializedParameterStack(IPlugin plugin)
        {
            // check if already available in cache
            ParameterStack stack = GetStackFromCache(plugin.Guid);

            if (null == stack)
            {
                if (!(SearchMethod is IComponentSearchMethod))
                {
                    throw new PluginException("Component loader was not initialized with a valid plugin search method.");
                }

                // get parameter stack
                if (plugin is IPluginExt1 pluginExt1)
                {
                    stack = plugin.Parameters;
                }
                else if (plugin is IPluginExt2 pluginExt2)
                {
                    stack = pluginExt2.BuildParameterStack(null);
                }
                else if (plugin is IPluginExt3 pluginExt3)
                {
                    stack = pluginExt3.BuildParameterStack(null);
                }
                else if (plugin is IPluginExt4 pluginExt4)
                {
                    stack = pluginExt4.BuildParameterStack(null);
                }
                // check parameter stack
                if (null == stack)
                {
                    throw new PluginException("Failed to build initial parameter stack.");
                }

                string grpId = string.Empty;

                // load parameter values from plugins
                foreach (Parameter param in stack)
                {
                    try
                    {
                        if (param is ParameterDouble pd)
                        {
                            stack.SetDoubleParameter(pd.Name, SearchMethod.GetDoubleParameterDefaultValue(grpId, plugin.Guid, pd.Name));
                        }
                        if (param is ParameterBool pb)
                        {
                            stack.SetBoolParameter(pb.Name, SearchMethod.GetBoolParameterDefaultValue(grpId, plugin.Guid, pb.Name));
                        }
                        if (param is ParameterInt pi)
                        {
                            stack.SetIntParameter(pi.Name, SearchMethod.GetIntParameterDefaultValue(grpId, plugin.Guid, pi.Name));
                        }
                        if (param is ParameterMulti pm)
                        {
                            stack.SetMultiParameter(pm.Name, SearchMethod.GetMultiParameterDefaultValue(grpId, plugin.Guid, pm.Name));
                        }
                    }
                    catch (Exception /*ex*/)
                    {
                    }
                }
                // save in cache
                InsertParameterStackInCache(plugin.Guid, stack);
            }
            return(stack.Clone());
        }
Beispiel #32
0
 public double ImpositionOffsetY(ParameterStack stack) { return 0.0; }
Beispiel #33
0
 /// <summary>
 /// Creates factory entities (mostly segment, arcs, cotations...) in <see cref="PicFactory"/> class instance passed as first argument
 /// </summary>
 /// <param name="factory">Instance of class <see cref="PicFactory"/> to be populated with entities</param>
 /// <param name="stack">Array of <see cref="Paramerter"/> to apply while generating entities</param>
 public void CreateFactoryEntities(PicFactory factory, ParameterStack stack)
 {
     _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity);
 }
Beispiel #34
0
 public Enumerator(ParameterStack obj)
 {
     oThis   = obj;
     cursor  = -1;
     version = oThis._version;
 }
Beispiel #35
0
 public ParameterStackUpdater(ParameterStack stackIn)
 {
     _stackIn  = null != stackIn ? stackIn : new ParameterStack();
     _stackOut = new ParameterStack();
 }
Beispiel #36
0
 public ParameterStackUpdater(ParameterStack stackIn)
 {
     _stackIn     = stackIn ?? new ParameterStack();
     UpdatedStack = new ParameterStack();
 }
Beispiel #37
0
 private static void InsertParameterStackInCache(Guid guid, ParameterStack stack)
 {
     _parameterStackCache[guid] = stack;
 }
Beispiel #38
0
 /// <summary>
 /// Creates factory entities (mostly segment, arcs, cotations...) in <see cref="PicFactory"/> class instance passed as first argument
 /// </summary>
 /// <param name="factory">Instance of class <see cref="PicFactory"/> to be populated with entities</param>
 /// <param name="stack">Array of <see cref="Paramerter"/> to apply while generating entities</param>
 public void CreateFactoryEntities(PicFactory factory, ParameterStack stack)
 {
     _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity);
 }
Beispiel #39
0
 public ParameterStack Clone()
 {
     ParameterStack stackCopy = new ParameterStack();
     foreach (Parameter p in _parameterList)
         stackCopy.AddParameter(p.Clone());
     return stackCopy;
 }
Beispiel #40
0
 public bool GetFlatDimensions(ParameterStack stack, ref double length, ref double width, ref double height)
 {
     if (null != _ext3 && _ext3.IsSupportingFlatPalletization)
     {
         double[] dim;
         _ext3.FlatDimensions(stack, out dim);
         length = dim[0]; width = dim[1]; height = dim[2];
         return true;
     }
     return false;
 }
Beispiel #41
0
 public Enumerator(ParameterStack obj)
 {
     oThis = obj;
     cursor = -1;
     version = oThis._version;
 }
Beispiel #42
0
        public void GenerateImage(Size size, ParameterStack stack, out Image bmp)
        {
            // check if plugin was instantiated
            if (null == _component)
                throw new Exception("No valid plugin instance loaded!");

            // instantiate factory
            PicFactory factory = new PicFactory();
            // generate entities
            _component.CreateFactoryEntities(factory, stack);
            // apply any needed transformation
            if (_reflexionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
            if (_reflexionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
            // get bounding box
            PicVisitorBoundingBox visitor = new PicVisitorBoundingBox();
            factory.ProcessVisitor(visitor);
            Pic.Factory2D.Box2D box = visitor.Box;
            box.AddMarginRatio(0.05);
            // draw image
            PicGraphicsImage picImage = new PicGraphicsImage(size, box);
            factory.Draw(picImage, _showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation);

            bmp = picImage.Bitmap;
        }
Beispiel #43
0
 public ParameterStackUpdater(ParameterStack stackIn)
 {
     _stackIn = null != stackIn ? stackIn : new ParameterStack();
     _stackOut = new ParameterStack();
 }
Beispiel #44
0
        public byte[] GenerateExportFile(string fileFormat, ParameterStack stack)
        {
            // build factory
            Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory();
            _component.CreateFactoryEntities(factory, stack);
            if (_reflexionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
            if (_reflexionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));

            // instantiate filter
            PicFilter filter = (_showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation) & PicFilter.FilterNoZeroEntities;

            // get bounding box
            Pic.Factory2D.PicVisitorBoundingBox visitorBoundingBox = new Pic.Factory2D.PicVisitorBoundingBox();
            factory.ProcessVisitor(visitorBoundingBox, filter);
            Pic.Factory2D.Box2D box = visitorBoundingBox.Box;
            // add margins : 5 % of the smallest value among height 
            box.AddMarginHorizontal(box.Width * 0.05);
            box.AddMarginVertical(box.Height * 0.05);
            // get file content
            if ("des" == fileFormat)
            {
                Pic.Factory2D.PicVisitorDesOutput visitor = new Pic.Factory2D.PicVisitorDesOutput();
                visitor.Author = "treeDiM";
                // process visitor
                factory.ProcessVisitor(visitor, filter);
                return visitor.GetResultByteArray();
            } 
            else if ("dxf" == fileFormat)
            {
                Pic.Factory2D.PicVisitorOutput visitor = new Pic.Factory2D.PicVisitorDxfOutput();
                visitor.Author = "treeDiM";
                // process visitor
                factory.ProcessVisitor(visitor, filter);
                return visitor.GetResultByteArray();

            }
            else if ("pdf" == fileFormat)
            {
                PicGraphicsPdf graphics = new PicGraphicsPdf(box);
                graphics.Author = "treeDiM";
                graphics.Title = "Pdf Export";
                // draw
                factory.Draw(graphics, filter);
                return graphics.GetResultByteArray();
            }
            else
                throw new Exception("Invalid file format : " + fileFormat);
        }
        public bool LoadComponent(string filePath)
        {
            _filePath = filePath;
            if (DesignMode)
            {
                return(false);
            }
            try
            {
                // initialize control
                pluginViewCtrl.PluginPath = filePath;

                // load component
                Pic.Plugin.Component component = null;
                using (Pic.Plugin.ComponentLoader loader = new Pic.Plugin.ComponentLoader())
                {
                    loader.SearchMethod = new ComponentSearchMethodDB();
                    component           = loader.LoadComponent(filePath);
                }
                if (null == component)
                {
                    return(false);
                }
                _componentGuid = component.Guid;

                // get parameters
                Pic.Plugin.ParameterStack stack = null;
                stack = component.BuildParameterStack(null);
                // fill name/description if empty
                _componentName        = component.Name;
                _componentDescription = component.Description;
                // build dict of double parameters
                _dictParamDefaultValues.Clear();
                foreach (Parameter param in stack.ParameterList)
                {
                    ParameterDouble paramDouble = param as ParameterDouble;
                    if (null != paramDouble)
                    {
                        _dictParamDefaultValues[paramDouble.Name] = paramDouble.ValueDefault;
                    }
                }
                // insert majoration label and textbox controls
                const int lblX = 16, lblY = 51;
                const int offsetX = 100, offsetY = 29;
                const int lbSizeX = 34, lbSizeY = 14;
                int       tabIndex = comboBoxProfile.TabIndex;

                groupBoxMajorations.Controls.Clear();

                bool hasMajorations = stack.HasMajorations;
                if (hasMajorations)
                {
                    // add combo box / label again
                    groupBoxMajorations.Controls.Add(lblProfile);
                    groupBoxMajorations.Controls.Add(comboBoxProfile);

                    int iCount = 0;
                    foreach (Parameter param in stack)
                    {
                        if (!param.IsMajoration)
                        {
                            continue;
                        }
                        // label
                        Label lbl = new Label();
                        lbl.Name     = string.Format("lbl_{0}", param.Name);
                        lbl.Text     = param.Name;
                        lbl.Location = new Point(
                            lblX + (iCount / 4) * offsetX
                            , lblY + (iCount % 4) * offsetY);
                        lbl.Size     = new Size(lbSizeX, lbSizeY);
                        lbl.TabIndex = ++tabIndex;
                        groupBoxMajorations.Controls.Add(lbl);
                        // text box
                        TextBox tb = new TextBox();
                        tb.Name     = string.Format("tb_{0}", param.Name);
                        tb.Text     = string.Format("{0:0.##}", stack.GetDoubleParameterValue(param.Name));
                        tb.Location = new Point(
                            lblX + (iCount / 4) * offsetX + lbl.Size.Width + 1
                            , lblY + (iCount % 4) * offsetY);
                        tb.Size     = new Size(50, 20);
                        tb.TabIndex = ++tabIndex;
                        groupBoxMajorations.Controls.Add(tb);
                        // increment count
                        ++iCount;
                    }
                }
                groupBoxMajorations.Visible = hasMajorations;
                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                return(false);
            }
        }
Beispiel #46
0
 private static void InsertParameterStackInCache(Guid guid, ParameterStack stack)
 {
     _parameterStackCache[guid] = stack;
 }
Beispiel #47
0
        static public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform)
        {
            PicFactory fTemp = new PicFactory();
            const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT;
            const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING;

            // free variables
            double A = stack.GetDoubleParameterValue("A");
            double B = stack.GetDoubleParameterValue("B");
            double H = stack.GetDoubleParameterValue("H");
            double e = stack.GetDoubleParameterValue("e");
            double g = stack.GetDoubleParameterValue("g");
            double hc = stack.GetDoubleParameterValue("hc");
            double pr = stack.GetDoubleParameterValue("pr");

            // formulas
            double hp = B / 2 - e;
            double v9 = g * Tand(15);
            double v1 = 8;
            double v2 = 8;
            double v3 = hp * Tand(15);
            double r = pr / 4;
            SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>();

            // segments
            double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0;

            // 3 : (481.462, 303.394) <-> (481.462, 467.206)
            x0 = 69.6211 + g + A + B + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(3, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 4 : (223.218, 468.17) <-> (352.341, 468.17)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e;
            entities.Add(4, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 5 : (352.341, 467.206) <-> (480.017, 467.206)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A + B + A - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(5, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 6 : (352.34, 302.431) <-> (223.218, 302.431)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e;
            entities.Add(6, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 7 : (352.34, 303.394) <-> (480.017, 303.394)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B + A - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(7, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 8 : (223.218, 240.761) <-> (101.323, 240.761)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc;
            x1 = 69.6211 + g + e + v2;
            y1 = 120.793 + g + B / 2 - 2 * e + hc;
            entities.Add(8, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 9 : (223.218, 211.853) <-> (101.323, 211.853)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e;
            x1 = 69.6211 + g + e + v2;
            y1 = 120.793 + g + B / 2 - 2 * e;
            entities.Add(9, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 10 : (352.34, 211.853) <-> (474.235, 211.853)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e;
            x1 = 69.6211 + g + A + B + A - e - v2;
            y1 = 120.793 + g + B / 2 - 2 * e;
            entities.Add(10, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 11 : (352.34, 240.761) <-> (474.235, 240.761)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc;
            x1 = 69.6211 + g + A + B + A - e - v2;
            y1 = 120.793 + g + B / 2 - 2 * e + hc;
            entities.Add(11, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 12 : (352.341, 530.804) <-> (461.326, 530.804)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            x1 = 69.6211 + g + A + B + A - e - v3;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            entities.Add(12, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 13 : (94.0963, 467.206) <-> (69.6211, 462.388)
            x0 = 69.6211 + g;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H - v9;
            entities.Add(13, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 14 : (69.6211, 308.213) <-> (69.6211, 462.388)
            x0 = 69.6211;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + v9;
            x1 = 69.6211;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H - v9;
            entities.Add(14, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 15 : (94.0963, 303.395) <-> (69.621, 308.213)
            x0 = 69.6211 + g;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + v9;
            entities.Add(15, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 16 : (223.218, 303.394) <-> (95.542, 303.394)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(16, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 17 : (223.218, 467.206) <-> (95.5415, 467.206)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(17, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 18 : (352.34, 149.701) <-> (474.235, 149.701)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A + B + A - e - v2;
            y1 = 120.793 + g;
            entities.Add(18, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 19 : (466.489, 120.793) <-> (360.086, 120.793)
            x0 = 69.6211 + g + A + B + A - e - v2 - v9;
            y0 = 120.793;
            x1 = 69.6211 + g + A + B + v9;
            y1 = 120.793;
            entities.Add(19, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 20 : (480.017, 467.206) <-> (480.017, 476.842)
            x0 = 69.6211 + g + A + B + A - e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A + B + A - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5;
            entities.Add(20, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 21 : (474.235, 482.623) <-> (480.017, 476.842)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2;
            x1 = 69.6211 + g + A + B + A - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5;
            entities.Add(21, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 22 : (474.235, 482.623) <-> (461.326, 530.804)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2;
            x1 = 69.6211 + g + A + B + A - e - v3;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            entities.Add(22, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 23 : (223.218, 530.804) <-> (114.233, 530.804)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            x1 = 69.6211 + g + e + v3;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            entities.Add(23, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 24 : (95.5415, 467.206) <-> (95.5415, 476.842)
            x0 = 69.6211 + g + e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5;
            entities.Add(24, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 25 : (101.323, 482.624) <-> (95.5415, 476.842)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5;
            entities.Add(25, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 26 : (101.323, 482.624) <-> (114.233, 530.804)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2;
            x1 = 69.6211 + g + e + v3;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            entities.Add(26, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 27 : (223.218, 149.701) <-> (101.323, 149.701)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + e + v2;
            y1 = 120.793 + g;
            entities.Add(27, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 28 : (215.473, 120.793) <-> (109.069, 120.793)
            x0 = 69.6211 + g + A - v9;
            y0 = 120.793;
            x1 = 69.6211 + g + e + v2 + v9;
            y1 = 120.793;
            entities.Add(28, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 29 : (480.017, 303.394) <-> (480.017, 293.759)
            x0 = 69.6211 + g + A + B + A - e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B + A - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5;
            entities.Add(29, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 30 : (474.235, 287.977) <-> (480.017, 293.759)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2;
            x1 = 69.6211 + g + A + B + A - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5;
            entities.Add(30, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 31 : (95.542, 303.394) <-> (95.542, 293.759)
            x0 = 69.6211 + g + e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5;
            entities.Add(31, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 32 : (101.323, 287.978) <-> (95.542, 293.759)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5;
            entities.Add(32, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 33 : (101.323, 149.701) <-> (109.069, 120.793)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + e + v2 + v9;
            y1 = 120.793;
            entities.Add(33, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 34 : (223.218, 149.701) <-> (215.473, 120.793)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A - v9;
            y1 = 120.793;
            entities.Add(34, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 35 : (352.34, 149.699) <-> (360.086, 120.793)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A + B + v9;
            y1 = 120.793;
            entities.Add(35, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 36 : (474.235, 149.701) <-> (466.489, 120.793)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A + B + A - e - v2 - v9;
            y1 = 120.793;
            entities.Add(36, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 37 : (609.621, 303.394) <-> (609.621, 467.206)
            x0 = 69.6211 + g + A + B + A + B - e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B + A + B - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(37, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 38 : (94.0963, 467.206) <-> (95.5415, 467.206)
            x0 = 69.6211 + g;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(38, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 39 : (94.0963, 303.394) <-> (95.542, 303.394)
            x0 = 69.6211 + g;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(39, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 40 : (94.0963, 303.394) <-> (94.0963, 467.206)
            x0 = 69.6211 + g;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(40, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 41 : (236.709, 594.401) <-> (338.85, 594.401)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A;
            x1 = 69.6211 + g + A + B - 2 * e - v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A;
            entities.Add(41, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 42 : (340.524, 625.236) <-> (235.034, 625.236)
            x0 = 69.6211 + g + A + B - 2 * e - v1 + 1.6741;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr;
            x1 = 69.6211 + g + A + 2 * e + v1 - 1.67455;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr;
            entities.Add(42, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 43 : (348.524, 617.236) <-> (348.524, 596.328)
            x0 = 69.6211 + g + A + B - 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr - 8.00006;
            x1 = 69.6211 + g + A + B - 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(43, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 59 : (227.034, 617.236) <-> (227.034, 596.328)
            x0 = 69.6211 + g + A + 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr - 8;
            x1 = 69.6211 + g + A + 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(59, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 69 : (338.85, 176.2) <-> (236.709, 176.2)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A;
            x1 = 69.6211 + g + A + 2 * e + v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A;
            entities.Add(69, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 70 : (235.035, 145.365) <-> (339.525, 145.364)
            x0 = 69.6211 + g + A + 2 * e + v1 - 1.67406;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - pr;
            x1 = 69.6211 + g + A + B - 2 * e - v1 + 0.674561;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - pr;
            entities.Add(70, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 71 : (227.035, 153.365) <-> (227.035, 174.272)
            x0 = 69.6211 + g + A + 2 * e;
            y0 = 120.793 + g + 3.66388;
            x1 = 69.6211 + g + A + 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(71, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 73 : (348.525, 174.272) <-> (348.525, 154.364)
            x0 = 69.6211 + g + A + B - 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A + B - 2 * e;
            y1 = 120.793 + g + 4.66336;
            entities.Add(73, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 98 : (227.034, 596.328) <-> (223.218, 596.328)
            x0 = 69.6211 + g + A + 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(98, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 99 : (236.709, 596.328) <-> (227.034, 596.328)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            x1 = 69.6211 + g + A + 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(99, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 100 : (352.341, 303.394) <-> (352.341, 467.206)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(100, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 101 : (352.341, 467.206) <-> (352.341, 467.399)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(101, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 102 : (223.218, 303.394) <-> (223.218, 467.206)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(102, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 103 : (223.218, 467.206) <-> (223.218, 467.399)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(103, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1));

            // 104 : (480.017, 467.206) <-> (481.462, 467.206)
            x0 = 69.6211 + g + A + B + A - e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A + B + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(104, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 105 : (481.462, 467.206) <-> (609.621, 467.206)
            x0 = 69.6211 + g + A + B + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A + B + A + B - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(105, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 106 : (480.017, 303.394) <-> (481.462, 303.394)
            x0 = 69.6211 + g + A + B + A - e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(106, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 107 : (481.462, 303.394) <-> (609.621, 303.394)
            x0 = 69.6211 + g + A + B + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            x1 = 69.6211 + g + A + B + A + B - e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(107, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 108 : (352.341, 468.17) <-> (352.341, 467.399)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            entities.Add(108, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 109 : (352.341, 530.804) <-> (352.341, 468.17)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e;
            entities.Add(109, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 110 : (352.341, 596.328) <-> (352.341, 530.804)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            entities.Add(110, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 111 : (223.218, 467.399) <-> (223.218, 468.17)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e;
            entities.Add(111, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 112 : (223.218, 468.17) <-> (223.218, 530.804)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            entities.Add(112, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 113 : (223.218, 530.804) <-> (223.218, 596.328)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(113, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 114 : (474.235, 149.701) <-> (474.235, 211.853)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A + B + A - e - v2;
            y1 = 120.793 + g + B / 2 - 2 * e;
            entities.Add(114, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 115 : (474.235, 211.853) <-> (474.235, 240.761)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g + B / 2 - 2 * e;
            x1 = 69.6211 + g + A + B + A - e - v2;
            y1 = 120.793 + g + B / 2 - 2 * e + hc;
            entities.Add(115, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 116 : (474.235, 240.761) <-> (474.235, 287.977)
            x0 = 69.6211 + g + A + B + A - e - v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc;
            x1 = 69.6211 + g + A + B + A - e - v2;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2;
            entities.Add(116, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 117 : (101.323, 149.701) <-> (101.323, 211.853)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + e + v2;
            y1 = 120.793 + g + B / 2 - 2 * e;
            entities.Add(117, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 118 : (101.323, 211.853) <-> (101.323, 240.761)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g + B / 2 - 2 * e;
            x1 = 69.6211 + g + e + v2;
            y1 = 120.793 + g + B / 2 - 2 * e + hc;
            entities.Add(118, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 119 : (101.323, 240.761) <-> (101.323, 287.978)
            x0 = 69.6211 + g + e + v2;
            y0 = 120.793 + g + B / 2 - 2 * e + hc;
            x1 = 69.6211 + g + e + v2;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2;
            entities.Add(119, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 120 : (223.218, 149.701) <-> (223.218, 174.272)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(120, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 121 : (223.218, 174.272) <-> (223.218, 211.853)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e;
            entities.Add(121, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 122 : (223.218, 211.853) <-> (223.218, 240.761)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc;
            entities.Add(122, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 123 : (223.218, 240.761) <-> (223.218, 302.431)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e;
            entities.Add(123, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 124 : (223.218, 302.431) <-> (223.218, 303.394)
            x0 = 69.6211 + g + A;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(124, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 125 : (352.34, 149.701) <-> (352.34, 174.272)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(125, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 126 : (352.34, 174.272) <-> (352.34, 211.853)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e;
            entities.Add(126, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 127 : (352.34, 211.853) <-> (352.34, 240.761)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc;
            entities.Add(127, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 128 : (352.34, 240.761) <-> (352.34, 302.431)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e;
            entities.Add(128, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 129 : (352.34, 302.431) <-> (352.34, 303.394)
            x0 = 69.6211 + g + A + B;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e;
            entities.Add(129, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 130 : (338.85, 596.328) <-> (348.524, 596.328)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            x1 = 69.6211 + g + A + B - 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(130, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 131 : (348.524, 596.328) <-> (352.341, 596.328)
            x0 = 69.6211 + g + A + B - 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(131, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 132 : (338.85, 592.474) <-> (338.85, 594.401)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A - e;
            x1 = 69.6211 + g + A + B - 2 * e - v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A;
            entities.Add(132, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 133 : (338.85, 594.401) <-> (338.85, 596.328)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A;
            x1 = 69.6211 + g + A + B - 2 * e - v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            entities.Add(133, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 134 : (236.709, 594.401) <-> (236.709, 592.474)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A;
            x1 = 69.6211 + g + A + 2 * e + v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A - e;
            entities.Add(134, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 135 : (236.709, 596.328) <-> (236.709, 594.401)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e;
            x1 = 69.6211 + g + A + 2 * e + v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A;
            entities.Add(135, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 136 : (338.85, 174.272) <-> (348.525, 174.272)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A + B - 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(136, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 137 : (348.525, 174.272) <-> (352.341, 174.272)
            x0 = 69.6211 + g + A + B - 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A + B;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(137, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 138 : (227.035, 174.272) <-> (223.218, 174.272)
            x0 = 69.6211 + g + A + 2 * e;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(138, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 139 : (236.709, 174.272) <-> (227.035, 174.272)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A + 2 * e;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(139, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 140 : (236.709, 176.2) <-> (236.709, 174.272)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A;
            x1 = 69.6211 + g + A + 2 * e + v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            entities.Add(140, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 141 : (236.709, 178.127) <-> (236.709, 176.2)
            x0 = 69.6211 + g + A + 2 * e + v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A + e;
            x1 = 69.6211 + g + A + 2 * e + v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A;
            entities.Add(141, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 142 : (338.85, 174.272) <-> (338.85, 176.2)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e;
            x1 = 69.6211 + g + A + B - 2 * e - v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A;
            entities.Add(142, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // 143 : (338.85, 176.2) <-> (338.85, 178.127)
            x0 = 69.6211 + g + A + B - 2 * e - v1;
            y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A;
            x1 = 69.6211 + g + A + B - 2 * e - v1;
            y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A + e;
            entities.Add(143, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1));

            // arcs
            // 44 : radius = 8  s0 = 42  s1 = 43
            fTemp.ProcessTool(new PicToolRound(
                  entities[42]
                , entities[43]
                , r						// radius
                ));
            // 60 : radius = 8  s0 = 42  s1 = 59
            fTemp.ProcessTool(new PicToolRound(
                  entities[42]
                , entities[59]
                , r						// radius
                ));
            // 72 : radius = 8  s0 = 70  s1 = 71
            fTemp.ProcessTool(new PicToolRound(
                  entities[70]
                , entities[71]
                , r						// radius
                ));
            // 144 : radius = 9  s0 = 70  s1 = 73
            fTemp.ProcessTool(new PicToolRound(
                  entities[70]
                , entities[73]
                , r						// radius
                ));

            factory.AddEntities(fTemp, transform);
        }
Beispiel #48
0
 private void ClearParameterStack()
 {
     _paramStackCurrent = null;
     SetParametersDirty();
     Panel2.Controls.Clear();
 }
        public FormEditMajorations(Guid compGuid, Profile currentProfile, ProfileLoader profileLoader)
        {
            InitializeComponent();

            if (compGuid == Guid.Empty)
            {
                throw new Exception("Invalid component Guid");
            }

            _compGuid      = compGuid;
            _profileLoader = profileLoader;

            if (!DesignMode)
            {
                // plugin viewer
                _pluginViewCtrl          = new PluginViewCtrl();
                _pluginViewCtrl.Size     = _pb.Size;
                _pluginViewCtrl.Location = _pb.Location;
                _pluginViewCtrl.Visible  = true;
                this.Controls.Add(_pluginViewCtrl);
                // hide
                _pb.Visible = false;
            }

            // fill combo box
            FillProfileComboBox(currentProfile.ToString());

            // get parameter stack
            PLMPackServiceClient client = WCFClientSingleton.Instance.Client;

            Pic.Plugin.ParameterStack stack = null;
            using (Pic.Plugin.ComponentLoader loader = new Pic.Plugin.ComponentLoader())
            {
                DCComponent          comp      = client.GetComponentByGuid(_compGuid);
                Pic.Plugin.Component component = loader.LoadComponent(
                    treeDiM.FileTransfer.FileTransferUtility.DownloadFile(comp.File.Guid, comp.File.Extension));
                stack = component.BuildParameterStack(null);
                // load component in pluginviewer
                _pluginViewCtrl.Component = component;
            }

            // insert majoration label and textbox controls
            int lblX = 20, lblY = 60;
            int offsetX = 110, offsetY = 29;
            int tabIndex = bnCancel.TabIndex;
            int iCount   = 0;

            foreach (Parameter param in stack.ParameterList)
            {
                // only shows majorations
                if (!param.IsMajoration)
                {
                    continue;
                }
                ParameterDouble paramDouble = param as ParameterDouble;
                // create Label control
                Label lbl = new Label();
                lbl.Name     = string.Format("lbl_{0}", param.Name);
                lbl.Text     = param.Name;
                lbl.Location = new Point(
                    lblX + (iCount / 5) * offsetX
                    , lblY + (iCount % 5) * offsetY);
                lbl.Size     = new Size(30, 13);
                lbl.TabIndex = ++tabIndex;
                this.Controls.Add(lbl);
                // create NumericUpDown control
                NumericUpDown nud = new NumericUpDown();
                nud.Name          = string.Format("nud_{0}", param.Name);
                nud.Increment     = 0.1M;
                nud.Minimum       = paramDouble.HasValueMin ? (decimal)paramDouble.ValueMin : -10000.0M;
                nud.Maximum       = paramDouble.HasValueMax ? (decimal)paramDouble.ValueMax : 10000.0M;
                nud.DecimalPlaces = 1;
                nud.Value         = (decimal)paramDouble.Value;
                nud.Location      = new Point(
                    lblX + (iCount / 5) * offsetX + lbl.Size.Width + 1
                    , lblY + (iCount % 5) * offsetY);
                nud.Size          = new Size(60, 20);
                nud.TabIndex      = ++tabIndex;
                nud.ValueChanged += new EventHandler(nudValueChanged);
                nud.GotFocus     += new EventHandler(nud_GotFocus);
                nud.Click        += new EventHandler(nud_GotFocus);
                this.Controls.Add(nud);

                ++iCount;
            }

            UpdateMajorationValues();
        }
Beispiel #50
0
 public void AnimateParameterName(string parameterName)
 {
     _parameterName = parameterName;
     // copies parameter stack
     tempParameterStack = CurrentParameterStack.Clone();
     // retrieve initial value for parameter
     _parameterInitialValue = tempParameterStack.GetDoubleParameterValue(_parameterName);
     // start timer
     _timerStep = 0;
     timer.Start();
 }
        void textBox_TextChanged(object sender, EventArgs e)
        {
            string filePath           = fileSelectCtrl.FileName;
            string fileExt            = System.IO.Path.GetExtension(filePath);
            bool   successfullyLoaded = false;

            if (System.IO.File.Exists(filePath) && (fileExt == ".dll"))
            {
                // try and load plugin
                try
                {
                    // load component
                    Pic.Plugin.Component component = null;
                    using (Pic.Plugin.ComponentLoader loader = new ComponentLoader())
                    {
                        loader.SearchMethod = new ComponentSearchMethodDB();
                        component           = loader.LoadComponent(filePath);
                    }
                    if (null == component)
                    {
                        return;
                    }
                    _componentGuid = component.Guid;

                    // generate image
                    Image image;
                    using (Pic.Plugin.Tools pluginTools = new Pic.Plugin.Tools(component, new ComponentSearchMethodDB()))
                    {
                        pluginTools.ShowCotations = false;
                        pluginTools.GenerateImage(pictureBoxFileView.Size, out image);
                    }
                    pictureBoxFileView.Image = image;

                    // get parameters
                    Pic.Plugin.ParameterStack stack = null;
                    stack = component.Parameters;
                    // fill name/description if empty
                    if (textBoxName.Text.Length == 0)
                    {
                        textBoxName.Text = component.Name;
                    }
                    if (textBoxDescription.Text.Length == 0)
                    {
                        textBoxDescription.Text = component.Description;
                    }

                    // insert majoration label and textbox controls
                    int lblX = 16, lblY = 41;
                    int offsetX = 100, offsetY = 29;
                    int tabIndex = comboBoxProfile.TabIndex;
                    groupBoxMajorations.Controls.Clear();
                    int iCount = 0;
                    for (int i = 1; i < 16; ++i)
                    {
                        string paramName = string.Format("m{0}", i);
                        if (!stack.HasParameter(paramName))
                        {
                            continue;
                        }

                        Label lbl = new Label();
                        lbl.Name     = string.Format("lbl_m{0}", i);
                        lbl.Text     = string.Format("m{0}", i);
                        lbl.Location = new Point(
                            lblX + (iCount / 4) * offsetX
                            , lblY + (iCount % 4) * offsetY);
                        lbl.Size     = new Size(24, 13);
                        lbl.TabIndex = ++tabIndex;
                        groupBoxMajorations.Controls.Add(lbl);

                        TextBox tb = new TextBox();
                        tb.Name     = string.Format("tb_m{0}", i);
                        tb.Text     = string.Format("{0:0.##}", stack.GetDoubleParameterValue(paramName));
                        tb.Location = new Point(
                            lblX + (iCount / 4) * offsetX + lbl.Size.Width + 1
                            , lblY + (iCount % 4) * offsetY);
                        tb.Size     = new Size(50, 20);
                        tb.TabIndex = ++tabIndex;
                        groupBoxMajorations.Controls.Add(tb);

                        ++iCount;
                    }

                    // Ok button enabled!
                    successfullyLoaded = true;
                }
                catch (Exception ex)
                {
                    Logger.Write(ex.ToString(), Category.General, Priority.Highest);
                }
            }

            // enable Ok button
            bnOk.Enabled = (textBoxName.TextLength != 0 && textBoxDescription.TextLength != 0 && successfullyLoaded);
        }
Beispiel #52
0
        private void RePaint(PaintEventArgs e, ParameterStack stack)
        { 
            try
            {
                // instantiate PicGraphics
                if (_picGraphics == null)
                    _picGraphics = new PicGraphicsCtrlBased(this.Panel1.ClientSize, e.Graphics);
                _picGraphics.GdiGraphics = e.Graphics;
                _picGraphics.Size = this.Panel1.ClientSize;

                // instantiate filter
                PicFilter filter = _showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation;

                // build factory
                using (Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory())
                {
                    // create entities
                    Component.CreateFactoryEntities(factory, stack);
                    if (_reflectionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
                    if (_reflectionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));

                    // remove existing quotations
                    factory.Remove((new PicFilterCode(PicEntity.eCode.PE_COTATIONDISTANCE))
                                    | (new PicFilterCode(PicEntity.eCode.PE_COTATIONHORIZONTAL))
                                    | (new PicFilterCode(PicEntity.eCode.PE_COTATIONVERTICAL))
                                    );
                    // build auto quotation
                    if (_showCotations)
                        PicAutoQuotation.BuildQuotation(factory);

                    // update drawing box?
                    if (_computeBbox)
                    {
                        Pic.Factory2D.PicVisitorBoundingBox visitor = new Pic.Factory2D.PicVisitorBoundingBox();
                        factory.ProcessVisitor(visitor);
                        _box = new Box2D(visitor.Box);
                        Box2D box = visitor.Box;
                        box.AddMarginRatio(0.05);
                        _picGraphics.DrawingBox = box;

                        // update factory data
                        if (null != factoryDataCtrl)
                            factoryDataCtrl.Factory = factory;

                        _computeBbox = false;
                    }
                    // draw
                    factory.Draw(_picGraphics, filter);
                }
            }
            catch (Pic.Plugin.PluginException ex)
            {
                // might happen
                _picGraphics.ShowMessage(ex.Message);
            }
            catch (Exception ex)
            {
                _picGraphics.ShowMessage(ex.ToString());
                _log.Error(ex.ToString());
            }        
        }
Beispiel #53
0
 public Sharp3D.Math.Core.Vector2D ReferencePoint(ParameterStack stack)
 {
     List<Vector2D> l = null;
     if (null != _ext2)
         l = _ext2.ReferencePoints(stack);
     else if (null != _ext3)
         l = _ext3.ReferencePoints(stack);
     if (null == l) return Vector2D.Zero;
     else if (l.Count > 0) return l[0];
     else return Vector2D.Zero;
 }