Support Forum

[Frage] Filling problem

Schlagworte:
  • PythonParts
  • Filling

<edit>Moved into good section</edit>

Hi,

I have 2 questions about filling in pythonparts :

-> transparency

I set a value for alpha canal like this :

fill_prop.FirstColor = AllplanBasisElements.ARGB (249, 227, 62, 50)

It's ok in preview but not working when I validate the element.

-> background / priority

How can I set the filling in background, it actualling hides some texts.

Best
Christophe

From Nemo

First:
Is the Filling used in a PythonPart, or is it created free on the document?
What is "not working" with the transparency? A screenshot would be helpful!
The Example PythonPart Filling works correct!

Second:
Unfortunately one property of the CommonProperties is not accessible via Python:
DrawOrder with values from 0...31
So, you have no way to control the order!

Hi,

Thanks for your reply,

The examples work and are a great source of inspiration.

Also, Im' trying to take back the elements I need (so far without success).

The filling is created via the pythonpart, here's the code and screenshots :

def create_objects(self, build_ele):
"""
Create the objects
"""

# Check script's version
if not hasattr(build_ele, 'init_string'):
build_ele.init_string = True
self.evaluate_strings(build_ele)

# Create views
views = []

# Set pythonpart properties
build_ele.Layer.value = 65497
build_ele.Pen.value = 8
build_ele.Stroke.value = 1
build_ele.Color.value = 1
build_ele.PenByLayer.value = True
build_ele.StrokeByLayer.value = True
build_ele.ColorByLayer.value = True

# Define common properties
com_prop = AllplanBaseElements.CommonProperties()
com_prop.GetGlobalProperties()
com_prop.Pen = build_ele.Pen.value
com_prop.Stroke = build_ele.Stroke.value
com_prop.Color = build_ele.Color.value

# Define filling properties
fill_prop = AllplanBasisElements.FillingProperties()
fill_prop.FirstColor = AllplanBasisElements.ARGB (249, 227, 62, 50)

# Define text properties
text_origin = AllplanGeo.Point2D(0, 0)
text_prop = AllplanBasisElements.TextProperties()
text_prop.Alignment = AllplanBasisElements.TextAlignment.eMiddleMiddle

# Create the 2D elements
path = AllplanGeo.Path2D()
path += AllplanGeo.Line2D(AllplanGeo.Point2D(-450, -200), AllplanGeo.Point2D(450, -200))
path += AllplanGeo.Arc2D(AllplanGeo.Point2D(-450, 0), 200, 200, math.pi / 2, 0, math.pi, True)
path += AllplanGeo.Line2D(AllplanGeo.Point2D(-450, 200), AllplanGeo.Point2D(450, 200))
path += AllplanGeo.Arc2D(AllplanGeo.Point2D(450, 0), 200, 200, math.pi / 2, math.pi, 0, True)
path = AllplanBasisElements.ModelElement2D(com_prop, path)
views.append(View2D([path]))

fillingarea = AllplanGeo.Polygon2D()
fillingarea += AllplanGeo.Point2D(-450, -200)
fillingarea += AllplanGeo.Point2D(450, -200)
fillingarea += AllplanGeo.Point2D(484.73, -196.96)
fillingarea += AllplanGeo.Point2D(518.40, -187.94)
fillingarea += AllplanGeo.Point2D(550, -173.21)
fillingarea += AllplanGeo.Point2D(578.56, -153.21)
fillingarea += AllplanGeo.Point2D(603.21, -128.56)
fillingarea += AllplanGeo.Point2D(623.21, -100)
fillingarea += AllplanGeo.Point2D(637.94, -68.40)
fillingarea += AllplanGeo.Point2D(646.96, -34.73)
fillingarea += AllplanGeo.Point2D(650, 0)
fillingarea += AllplanGeo.Point2D(646.96, 34.73)
fillingarea += AllplanGeo.Point2D(637.94, 68.40)
fillingarea += AllplanGeo.Point2D(623.21, 100)
fillingarea += AllplanGeo.Point2D(603.21, 128.56)
fillingarea += AllplanGeo.Point2D(578.56, 153.21)
fillingarea += AllplanGeo.Point2D(550, 173.21)
fillingarea += AllplanGeo.Point2D(518.40, 187.94)
fillingarea += AllplanGeo.Point2D(484.73, 196.96)
fillingarea += AllplanGeo.Point2D(450, 200)
fillingarea += AllplanGeo.Point2D(-450, 200)
fillingarea += AllplanGeo.Point2D(-484.73, 196.96)
fillingarea += AllplanGeo.Point2D(-518.40, 187.94)
fillingarea += AllplanGeo.Point2D(-550, 173.21)
fillingarea += AllplanGeo.Point2D(-578.56, 153.21)
fillingarea += AllplanGeo.Point2D(-603.21, 128.56)
fillingarea += AllplanGeo.Point2D(-623.21, 100)
fillingarea += AllplanGeo.Point2D(-637.94, 68.40)
fillingarea += AllplanGeo.Point2D(-646.96, 34.73)
fillingarea += AllplanGeo.Point2D(-650, 0)
fillingarea += AllplanGeo.Point2D(-646.96, -34.73)
fillingarea += AllplanGeo.Point2D(-637.94, -68.40)
fillingarea += AllplanGeo.Point2D(-623.21, -100)
fillingarea += AllplanGeo.Point2D(-603.21, -128.56)
fillingarea += AllplanGeo.Point2D(-578.56, -153.21)
fillingarea += AllplanGeo.Point2D(-550, -173.21)
fillingarea += AllplanGeo.Point2D(-518.40, -187.94)
fillingarea += AllplanGeo.Point2D(-484.73, -196.96)
fillingarea += AllplanGeo.Point2D(-450, -200)
filling = AllplanBasisElements.FillingElement(com_prop, fill_prop, fillingarea)
views.append(View2D([filling]))

text = build_ele.Alt.value
text = AllplanBasisElements.TextElement(com_prop, text_prop, text, text_origin)
views.append(View2D([text]))

# Create pythonpart
pythonpart = PythonPart("Elements",
build_ele.get_params_list(),
self._hash_value,
self._python_file,
views,
AllplanGeo.Matrix3D(),
com_prop
)

self.model_ele_list = pythonpart.create()

Best

Anhänge (2)

Typ: image/png
4-mal heruntergeladen
Größe: 10,87 KiB
Typ: image/png
4-mal heruntergeladen
Größe: 4,07 KiB

DrawOrder can be defined with :

com_prop.DrawOrder = 0