Skip to content

Db.Viewport.viewCenter() returns wrong values ​​(sometimes) #100

@gswifort

Description

@gswifort

The code below sometimes returns an incorrect .viewCenter() point. As I understand it, these should be the same values ​​as in the View section in the properties palette.
I am attaching a file where this problem occurs.

from pyrx_imp import Db, Ed, Ge


def PyRxCmd_doit():
    status, ent_id, *_ = Ed.Editor.entSel("Select viewport: ")
    if not status == Ed.PromptStatus.eOk:
        return
    vp = Db.Viewport(ent_id)
    coords = (*vp.viewCenter().toTuple(), 0.0)
    print(coords)
    point = Db.Point(Ge.Point3d(*coords))
    Db.curDb().addToModelspace(point)

image
viewport_bug.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions