Hi Stephan,

After taking Andy's hint regarding passing parameters, I've almost got this to work ... the shapes are being created when I pass PShape as the only argument to set_draw, but now no groups are created. Got to be something simple!

Thanks for all the help, when I get it right, then I'll send the code in a followup email.

Mike


Stephan Wunderlich - Sun Germany - ham02 - Hamburg wrote:

Hi Mike,

Thanks to recent help from the API DEV group volunteers, the below
routine works well when creating one shape....

sub set_draw(byval oPage as variant, byval Gradient as variant,_
     byval Shape1 as variant, byval PShape as variant,_
      byval PolyPolygon as variant, byval Shapes as object, byval Group
as object)

    PShape.PolyPolygon = Array(Shape1())
    PShape.Name = "Test" & asc(jj)
    oPage.add(PShape)
'        combine drawing elements
    Shapes.add(PShape)
    Group = oPage.group(Shapes)

    jj=jj+1

end sub

However, when called several times with design data points for several
shapes, during the same program session, the routine will create several
groups, but only one shape -- this shape ending up being a
representation of the last design entity and residing in the last group ...

Is there an equivalent to using PShape as an array?  I tried this and it
did not seem to work.


Hard to see what doesn't work from this snippet :-)

Well I tried the following and it nicely inserts me several PolypolygonShapes.

-------------------------------------------------------
sub main
    Shapes = ThisComponent.DrawPages(0)
    createShape(-3500)
    createShape(0)
    createShape(3500)
    Shapes.group(Shapes)
end sub

sub createShape(addme as Integer)
aShape = ThisComponent.createInstance("com.sun.star.drawing.PolyPolygonShape")
    Shapes = ThisComponent.DrawPages(0)
    Shapes.add(aShape)
Dim oSize As new com.sun.star.awt.Size
    Dim oPosition As new com.sun.star.awt.Point

    oSize.Width = 0
    oSize.Height = 0
    oPosition.X = 500+addme
    oPosition.Y = 500+addme

    aShape.Size = oSize
    aShape.Position = oPosition

    Dim ps1(3) As new com.sun.star.awt.Point
    ps1(0).X = 5000+addme : ps1(0).Y = 5000+addme
    ps1(1).X = 10000+addme : ps1(1).Y = 5000+addme
    ps1(2).X = 10000+addme : ps1(2).Y = 10000+addme
    ps1(3).X = 5000+addme : ps1(3).Y = 10000+addme

    Dim ps2(3) As new com.sun.star.awt.Point
    ps2(0).X = 6500+addme : ps2(0).Y = 6500+addme
    ps2(1).X = 8500+addme : ps2(1).Y = 6500+addme
    ps2(2).X = 8500+addme : ps2(2).Y = 8500+addme
    ps2(3).X = 6500+addme : ps2(3).Y = 8500+addme

    Dim psA(1) As Variant
    psA(0) = ps1()
    psA(1) = ps2()

    aShape.setPropertyValue("PolyPolygon", psA())
End sub
-------------------------------------------------------

Hope that helps

Regards

Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to