ExtrudedAreaSolid3D [Résolu]


Ich habe mit folgendem Code eine Extrusion erstellt.

    
    pol = AllplanGeo.Polygon3D()
    pol += AllplanGeo.Point3D(0, 0, 0)
    pol += AllplanGeo.Point3D(1, 0, 0)
    pol += AllplanGeo.Point3D(1, 1, 0)
    pol += AllplanGeo.Point3D(0, 0, 0)
    area = AllplanGeo.PolygonalArea3D()
    area += pol
    solid = AllplanGeo.ExtrudedAreaSolid3D()
    solid.SetDirection(AllplanGeo.Vector3D(1, 1, 1))
    solid.SetRefPoint(AllplanGeo.Point3D(5, 5, 5))
    solid.SetExtrudedArea(area)
    print(pol)
    print(type(pol))
    print(area)
    print(type(area))
    print(solid)
    print(type(solid))
    #model_ele_list.append(AllplanElements.ModelElement3D(com_prop, pol))
    #model_ele_list.append(AllplanElements.ModelElement3D(com_prop, area))
    model_ele_list.append(AllplanElements.ModelElement3D(com_prop, solid))

Der erstellte Solid ist valid, IsValid() gibt true zurück, aber weder der solid noch das area erscheinen am Bildschirm. Keine Fehlermeldung nichts. Das polygon pol erscheint als 3D-Fläche am Bildschirm. Kann es sein, dass ModelElement3D nicht alle Elemente akzeptiert?!

gruss bernd

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Show solution Hide solution

Hallo Bernd,

der ExtrudedAreaSolid ist nur ein Container für die Erzeugungsparameter.
Daraus wird erst ein "darstellbarer Körper" (BRep oder Polyhedron), indem man mit

err , phd = CreatePolyhedron(solid)

einen Polyeder erzeugt, und dann mit:

if err==Geo.eGeometryErrorCode.eOK:
model_ele_list.append(AllplanElements.ModelElement3D(com_prop, phd))

daraus ein ModelElement.

Selbiges gilt für:
ClippedSweptSolid3D
Cylinder3D
Polyline3D
Polygon2D
Polygon3D

Dank der fehlenden Typprüfung in Python (Ducktyping) kann man leider immer alles
mögliche in solch eine Funktion "reinreichen"...

Gruß Jörg

1 - 10 (14)

Hallo Bernd,

der ExtrudedAreaSolid ist nur ein Container für die Erzeugungsparameter.
Daraus wird erst ein "darstellbarer Körper" (BRep oder Polyhedron), indem man mit

err , phd = CreatePolyhedron(solid)

einen Polyeder erzeugt, und dann mit:

if err==Geo.eGeometryErrorCode.eOK:
model_ele_list.append(AllplanElements.ModelElement3D(com_prop, phd))

daraus ein ModelElement.

Selbiges gilt für:
ClippedSweptSolid3D
Cylinder3D
Polyline3D
Polygon2D
Polygon3D

Dank der fehlenden Typprüfung in Python (Ducktyping) kann man leider immer alles
mögliche in solch eine Funktion "reinreichen"...

Gruß Jörg

    err , phd = AllplanGeo.CreatePolyhedron(solid)
    if err==AllplanGeo.eGeometryErrorCode.eOK:
        model_ele_list.append(AllplanElements.ModelElement3D(com_prop, phd))

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Hallo Bernd,

..sorry, ich hab das aus dem Kopf da hingeschrieben, ohne zu Testen.
Fehlten ein paar Modul-Bezeichner?

Läuft es jetzt, oder was sollte der Re-Post uns sagen?

Gruß Jörg

Cité par Nemo
was sollte der Re-Post uns sagen?
Sorry Jörg, ich war aufn Spung. Der smily bedeutet so viel wie:

Hallo Jörg,
besten Dank für die schnelle punktgenau richtige Antwort und die Codezeilen. Es funktioniert damit einwandfrei. Ich hatte auch die Vermutung, das der Type für die Übergabe an die model_ele_list nicht stimmt, konnte aber in der API unter ModelElement3D nichts dazu fingen. Typeprüfungen sind so eine Sache. Das Ducktyping macht das programmieren mit Python aber auch sehr einfach. Als jemand der nur sehr selten C++ code anfässt (meistens nur zum debbuging) finde ich die ganze Typedeklaration von varialben, klassen und methoden dort immer sehr aufwendig, obwohl ich auch weiss dass dies riesiege Vorteile mit sich bringt.

Gruss Bernd

Die codezeilen sind eher eine erinnerung für mich für später. Die können direkt (einrückung, importmodulnamen) so unter den code im ersten post kopiert werden und es funktioniert.

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Solange ich mit Polygonen arbeite funktioniert das ganze sehr gut.

Ich will nun meine Fläche aus Kreisen und Linien zusammenbauen. Da braucht es wohl wieder andere Container. Ich kann mit Arc3D() problemlos einen Kreis erzeugen, aber wie kann ich den extrudieren? Ich habe versucht den arc in ein ClosedArea3D() zu packen und das zu extrudieren. Dabei scheitert es schon, aufgrund falscher C++ signatur, heisst dies ist wohl nicht der richtige Container.

Welche container müssen für ein Gebilde aus 3D-Linien und 3D-Kreisbögen welche eine geschlossene Fläche bilden verwendet werden, um eine Fläche zum extrudieren erstellen?

gruss bernd

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Hallo Bernd,

sobald gekrümmte Geometrien (z.B. Kreis) dabei sind, müßte man daraus ein BRep machen:

line = AllplanGeo.Line3D(...)
arc = AllplanGeo.Arc3D(...)
path = AllplanGeo.Line3D(...)
axis = AllplanGeo.Vector3D(0,0,1.0)

profile = AllplanGeo.Path3D()
profile += line
profile += arc

##line and arc must be connected!
##only arc is possible, if arc is closed (circle), then a solid is created, otherwise surface only

profiles = [profile]

closegaps = True
railrotation=True

err,brep=AllplanGeo.CreateSweptBRep3D(profiles,path,closegaps,railrotation,axis)
if err==AllplanGeo.eOK:
...

Gruß Jörg

Vielen Dank jörg.

CreateSweptBRep3D gibt es in 2016.1 nicht und irgendwie auch kein wirklich ähnliches. Da ich ja neu nun auch zusätzlich 2017 am laufen hab wollte ich dort schnell testen, aber alle meine scripte laufen da nicht. Die modulnamen haben sich etwas geändert. Mhh mal sehn wie das jetzt am besten löse, die Entwicklunsplattform ist 2017 und produktive im Büro haben wir 2016.1 ...

Ich komme wieder ...

gruss bernd

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Hallo Jörg,

Mhh, Fehler ...

import NemAll_Python_Geometry as Geo
import NemAll_Python_BaseElements as Prop
import NemAll_Python_BasisElements as Ele

def check_allplan_version(build_ele, version):
    return True

def create_element(build_ele, doc):
    com_prop = Prop.CommonProperties()
    com_prop.GetGlobalProperties()

    import math
    aArc = Geo.Arc3D(Geo.Point3D(0, 0, 0), Geo.Vector3D(1, 0, 0), Geo.Vector3D(0, 0, 1), 100, 100, 0, math.pi, True)
    aLine = Geo.Line3D(Geo.Point3D(-100, 0, 0),Geo.Point3D(100, 0, 0))

    axis = Geo.Vector3D(0, 0, 1.0)
    extrudepath = Geo.Line3D(Geo.Point3D(0, 0, 0),Geo.Point3D(0, 0, 200))
    profile = Geo.Path3D()
    profile += aArc
    profile += aLine
    profiles = [profile]
    closegaps = True
    railrotation = True
    err, brep = Geo.CreateSweptBRep3D(profiles, extrudepath, closegaps, railrotation, axis)  # 2017
    print(brep)
    model_ele_list = [(Ele.ModelElement3D(com_prop, brep))]

    return (model_ele_list, [])

Trace output:

Script =  BIMStatik\minipart3D
Script =  BIMStatik\minipart3D
Traceback (most recent call last):
  File "C:\ProgramData\Nemetschek\Allplan\2017\Etc\PythonPartsScripts\GeneralScripts\CreateLibraryPreview.py", line 65, in create_library_preview
    preview_element_list = build_element_script.create_element(build_ele_list[0], document)
  File "C:\Daten\Allplan\Allplan 2017\Prj\PythonParts.prj\PythonPartsScripts\BIMStatik\minipart3D.py", line 58, in create_element
    err, brep = Geo.CreateSweptBRep3D(profiles, extrudepath, closegaps, railrotation, axis)  # 2017
Boost.Python.ArgumentError: Python argument types in
    NemAll_Python_Geometry.CreateSweptBRep3D(list, Line3D, bool, bool, Vector3D)
did not match C++ signature:
    CreateSweptBRep3D(class boost::python::list profiles, class boost::python::api::object path, bool closecaps, bool railrotation, class Allplan::Geometry::Vector3D const * __ptr64 rotAxis, unsigned __int64 numprofiles)
    CreateSweptBRep3D(class boost::python::api::object profiles, class boost::python::api::object path, bool railrotation, class Allplan::Geometry::Vector3D const * __ptr64 rotAxis)

Meines erachtens stimmen aber die typen ...

gruss bernd

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Hallo Bernd,

was heisst: "Mhh, Fehler ..."

Mein Fehler?
Läuft das jetzt , oder nicht?

Geo.CreateLoftedBRep3D() gibt's auch noch!

Gruß Jörg

1 - 10 (14)

https://campus.allplan.com/ utilise des cookies  -  Plus d'informations

Accepter