public static ulong AddRectImageHatch(LJJSPoint leftBottomInsertPt, double rectHeigh, double rectWidth, string imagePath, double hatchScale, List <StrValueProperty> additionImageLst)
        {
            vdXProperties tmppro        = new vdXProperties();
            gPoint        leftBottomPt  = new gPoint(leftBottomInsertPt.XValue, leftBottomInsertPt.YValue);
            gPoint        leftTopPt     = new gPoint(leftBottomInsertPt.XValue, leftBottomInsertPt.YValue + DrawCommonData.DirectionUp * rectHeigh);
            gPoint        rightBottomPt = new gPoint(leftBottomInsertPt.XValue + rectWidth * DrawCommonData.DirectionRight, leftBottomInsertPt.YValue);
            gPoint        rightTopPt    = new gPoint(leftBottomInsertPt.XValue + rectWidth * DrawCommonData.DirectionRight, leftBottomInsertPt.YValue + DrawCommonData.DirectionUp * rectHeigh);

            Vertexes hatchRect = new Vertexes();

            hatchRect.Add(leftBottomPt);
            hatchRect.Add(leftTopPt);
            hatchRect.Add(rightTopPt);
            hatchRect.Add(rightBottomPt);
            if (null != additionImageLst && additionImageLst.Count > 0)
            {
                for (int i = 0; i < additionImageLst.Count; i++)
                {
                    StrValueProperty tmp = additionImageLst[i];
                    if (!string.IsNullOrEmpty(tmp.PropertyName) && !string.IsNullOrEmpty(tmp.PropertyValue))
                    {
                        vdXProperty tmpproperty = new vdXProperty();
                        tmpproperty.Name      = tmp.PropertyName;
                        tmpproperty.PropValue = tmp.PropertyValue;
                        tmppro.AddItem(tmpproperty);
                    }
                }
            }
            return(VectorDrawHelper.AddHatchImageToFigure(DrawCommonData.activeDocument, hatchRect, "", imagePath, hatchScale, tmppro));
        }
Exemple #2
0
 string GetPolyFace(vdPolyface vdf, vdXProperties vdxs)
 {
     foreach (vdXProperty vdx in vdxs)
     {
         if (vdx.Name.StartsWith(""))
         {
             string   str  = vdx.PropValue.ToString();
             string[] strs = str.Split(',');
         }
     }
     return("");
 }
Exemple #3
0
        public static ulong AddHatchImageToFigure(vdDocument activeDocument, Vertexes vertexs, string toolTip, string imagePath, double hatchScale, vdXProperties xProperties)
        {
            //We will create a vdPolyline object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdPolyline onepoly = new VectorDraw.Professional.vdFigures.vdPolyline();
            //We set the document where the polyline is going to be added.This is important for the vdPolyline in order to obtain initial properties with setDocumentDefaults.
            onepoly.SetUnRegisterDocument(activeDocument);
            onepoly.setDocumentDefaults();
            onepoly.ToolTip = toolTip;
            if (null != xProperties && xProperties.Count > 0)
            {
                for (int i = 0; i < xProperties.Count; i++)
                {
                    onepoly.XProperties.AddItem(xProperties[i]);
                }
            }


            onepoly.VertexList = vertexs;
            onepoly.Flag       = VectorDraw.Professional.Constants.VdConstPlineFlag.PlFlagCLOSE;

            //Initialize the hatch properties object.
            onepoly.HatchProperties = new VectorDraw.Professional.vdObjects.vdHatchProperties();
            //And change it's properties
            onepoly.HatchProperties.FillMode     = VectorDraw.Professional.Constants.VdConstFill.VdFillModeImage;
            onepoly.HatchProperties.HatchScale   = hatchScale;
            onepoly.HatchProperties.DrawBoundary = false;
            string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + imagePath;

            onepoly.HatchProperties.HatchImage = activeDocument.Images.Add(path);
            activeDocument.ActiveLayOut.Entities.AddItem(onepoly);
            return(onepoly.Handle.Value);
        }