Basic macro api extrusion PERSPECTIVE

Macro BASIC Windows 10 Pro

whilst amateur and seeing what can be done programming wise using Basic macros
i have been able to display shapes on a Calc sheet and after a time got part of the EXTURSION api to work

ProjectionMode.PARALLEL ok however ProjectionMode.PERSPECTIVE dosn’ appear to work
So using

oShape = oDoc.createInstance(“com.sun.star.drawing.CustomShape”)
oShape.CustomShapeEngine = “com.sun.star.drawing.EnhancedCustomShapeEngine”

this gives access to the service…EnhancedCustomShapeExtrusion
of which some examples

extu(0).Name = “Extrusion”
extu(0).Value = TRUE

extu(2).Name = “Origin”
extu(2).Value = org

extu(3).Name = “ViewPoint”
extu(3).Value = vpt

extu(4).Name = “skew”
extu(4).Value = skw

above appear to work …also show in .fods file (calc)
however

extu(5).Name = “Metal”
extu(5).Value = TRUE

and importanly
extu(1).Name = “ProjectionMode”
extu(1).Value = com.sun.star.drawing.ProjectionMode.PERSPECTIVE DOSNT APPEAR to work

, just shows default PARALLEL the skew appear to work.
i say appear as my first question is is the above syntax for a ENUM (PERSPECTIVE) correct ?

Further to this I have found in the pdf book “Custom Shape Tutorial “ by Regina Henschel that calc sheets can be stored in .fods format

so use macro to draw (extrude shape?) save under .fods format open using note pad varous attributes appear “ Extrusion” (TRUE), “Skew” , “origin” but “ProjectionMode” PERSPECTIVE dosnt just as a side point nor does metal .

However if in the .fods I cut and paste dr3rd:perspective amongst the atubutes ,save and refresh calc then the perpspective on the shape works ? Also where did dr3d come from not mentioned in the API docs as I can see.

To recape is extu(1) .Value = com.sun.star.drawing.ProjectionMode.PERSPECTIVE correct for using a ENUM … PERSPECTIVE ? If so why does it not appear in the .fods or work on calc basic macro

is there an unpublished dr3d service to be taken into account?
To recap using basic macro api is it possible to extrude a shspe in PERSPECTIVE ?
Or is this a possible bug ?

I would appreciate any respose even if its LibraOffice can only do so mush we don’t know !

Thanks

If you specify @Regina , then the author will probably see this message earlier. :slightly_smiling_face:

So it seems you have already found the idl-Reference?

Could you please post or attach the complete macro?

Do you have added the newly created shape to a draw page? Some properties only work if the shape is already inserted in the page.

My book is about manipulating a shape in file markup. The file markup uses the markup defined in the ODF 1.3 standard, Index of /office/OpenDocument/v1.3/os/. A BASIC macro does not use ODF but UNO. The prefix “dr3d” belongs to ODF.

To see the available UNO properties, insert a shape similar to the desired one and inspect it with the Development Tools (menu Tools). Select the shape left in the “Object” part and then click on tab “Properties” in the right part.

Sub shape_ExcusionD
   Dim oDoc As Object
   Dim oDrawPage As Object
   Dim oShape As Object
   Dim oSheet As Object
   Dim oCell As Object
 
   Dim shapeGeometry(4) as new com.sun.star.beans.PropertyValue
   Dim extu(15)          as new com.sun.star.beans.PropertyValue
   Dim txtA(3)          as new com.sun.star.beans.PropertyValue
   
   Dim extupr as new  com.sun.star.drawing.EnhancedCustomShapeParameterPair
   Dim skew as new  com.sun.star.drawing.EnhancedCustomShapeParameterPair
   
   Dim ae      as new  com.sun.star.drawing.EnhancedCustomShapeParameter
   Dim ad      as new  com.sun.star.drawing.EnhancedCustomShapeParameter
   Dim sk1  as new  com.sun.star.drawing.EnhancedCustomShapeParameter
   Dim sk2  as new  com.sun.star.drawing.EnhancedCustomShapeParameter
      
      
      
   Dim org   as new  com.sun.star.drawing.EnhancedCustomShapeParameterPair
   Dim xe     as new  com.sun.star.drawing.EnhancedCustomShapeParameter
   Dim yd     as new  com.sun.star.drawing.EnhancedCustomShapeParameter
   
   Dim vpoint   as new  com.sun.star.drawing.Position3D
   
   
   Dim oSize As new com.sun.star.awt.Rectangle
   Dim tom   As new com.sun.star.awt.Gradient
   Dim oSizeA As new com.sun.star.awt.Size
   Dim ShapePos As new com.sun.star.awt.Point
   
   
   oDoc = ThisComponent
   oDrawPage = oDoc.DrawPages(0)
   oSheet = oDoc.Sheets(0)
  
   oShape = oDoc.createInstance("com.sun.star.drawing.CustomShape")
   
   oDrawPage.add(oShape)
   
   oSizeA.width = 4000
   oSizeA.height = 2000
   
   oSize.width =  1000
   oSize.height = 1000
   oSize.X = 0
   oSize.Y = 0
   
   ae.Value = 15000
   ae.Type = NORMAL
   
   ad.Value =   oSheet.getCellByPosition(0,30).Value    '0.05
   ad.Type =  NORMAL
   
   extupr.First  = ae
   extupr.Second = ad
   
  
   
   
   
   sk1.Value = 40    
   sk1.Type = NORMAL
   
   sk2.Value = -45
   sk2.Type = NORMAL
   
   skew.First =sk1
   skew.Second =sk2
   
   
   xe.Value =-0.5           '600  0.5
   xe.Type = WIDTH
   
   yd.Value = 0           ' -2000  -0.5
   yd.Type = HEIGHT
   
   org.First  = xe
   org.Second = yd
  
   
   vpoint.PositionX =-3472
   vpoint.PositionY =  0                               '
   vpoint.PositionZ = 2500
   
   
   tom.StartColor = RGB(200,0, 0)
   tom.EndColor   = RGB(0,200,200)
   tom.StartIntensity = 200
   tom.EndIntensity = 200 
   tom.ANGLE = 0 
   tom.StepCount = 100

 
 
   
  extu(0).Name = "Extrusion"
  extu(0).Value =  TRUE          'TRUE
  
  extu(1).Name = "ProjectionMode"           
  extu(1).Value =   com.sun.star.drawing.ProjectionMode.PERSPECTIVE         
  
  extu(2).Name = "Metal"
  extu(2).Value = TRUE
  
  extu(3).Name = "Brightness"
  extu(3).Value = 10
  
  extu(4).Name = "Depth"
  extu(4).Value = extupr
  
  extu(5).Name = "ExtrusionColor"
  extu(5).State = TRUE                                    
  
  
  
  extu(6).Name = "Origin"
  extu(6).Value = org
  
  extu(7).Name = "ViewPoint"
  extu(7).Value = vpoint
  
  extu(8).Name ="Skew"
  extu(8).Value = skew
  
  
   txtA(0).Name = "TextPath"
   txtA(0).Value = FALSE
   
   txtA(1).Name = "TextPathMode"
   txtA(1).State = com.sun.star.drawing.EnhancedCustomShapeTextPathMode.SHAPE
   
   txtA(2).Name ="ScaleX"
   txtA(2).Value = TRUE
   
  
 
   shapeGeometry(0).Name = "Type"
   shapeGeometry(0).Value = "right-triangle" 'lightning" ' "flowchart-process"
   
   shapeGeometry(1).Name = "MirroredY"
   shapeGeometry(1).Value =   FALSE                
   
   shapeGeometry(2).Name ="Extrusion"
   shapeGeometry(2).Value = extu
   
   shapeGeometry(4).Name ="TextPath"
   shapeGeometry(4).Value = txtA
 
   
   
   
   oShape.CustomShapeEngine = "com.sun.star.drawing.EnhancedCustomShapeEngine"  '
   oShape.CustomShapeGeometry = shapeGeometry
      
    
   oShape.FillStyle = com.sun.star.drawing.FillStyle.GRADIENT
   oShape.LineStyle = com.sun.star.drawing.LineStyle.SOLID
   
   
    oShape.FillColor =   RGB(0,250,0,)
    'oShape.FillColor2 =  RGB(0,0,250)
   
   oShape.FillGradientName = "Gradient 7"
   
  
   oShape.FillTransparence = 20
    
    
   oShape.LineColor = RGB(250,100,0)
   oShape.LineStyle = com.sun.star.drawing.LineStyle.SOLID 
    
 
   
   oShape.Size = oSizeA
   
   ShapePos.X = 8000
   ShapePos.Y = 8000
   
   oShape.setPosition(ShapePos)  
   
    
  oShape.String =  " A"    
  oShape.CharHeight = 20   
  oShape.CharColor = RGB(0,0,250)                                                    '
   
End Sub  

Above is the macro I’ve put together when you run it you get a red triangle with a green PARRELL extusion althrougth under ProjectionMode it should be “ com.sun.star.drawing.ProjectionMode.PERSPECTIVE”
I’ve now found Development tools and along with x-ray it does show the extusion ProjectionMode 1 byte and x-ray shows various exanples of enum: which match the above macro syntax ie “com.sun.star.drawing.ProjectionMode.PERSPECTIVE “
At this stage if anybody can run rearrange whatever the macro above and make it extrude PERSPECTIVE I think we would all be grateful I must admit I’ll be surprised !
What also gets me is that under the 3d toolbar the perspective button works? If its API driven whatever language how comes that works and not when we use it in macro’s ?
Thanks

I think, that it is a bug and have written 157532 – ProjectionMode PERSPECTIVE for extruded custom shapes not possible via BASIC macro