Wrong rendering

Wrong rendering

DonatasAzaravicius
Advocate Advocate
1,484 Views
7 Replies
Message 1 of 8

Wrong rendering

DonatasAzaravicius
Advocate
Advocate

Hi, I made 3 custom entities. Lets call them "A", "B" and "C".

"B" have embedded AcDbText entity and "C" have AcDb3dSolid entity. AcDbText and AcDb3dSolid are not saved to drawing. All of them have exaggerate property, but only "A" save it to drawing, other two don't save it. They get it from "A" entity if exaggerate property change.

"A" have AcDbObjectId of "B" entities it governs. "B" Entities have AcDbObjectId of "C" entities they govern.

 

If I change exaggerate property everything works, but AcDbText and AcDb3dSolid entities sometimes jump from exaggerated state to original state if I rotate, zoom or select them. All this entities are placed in one group.

 

I have made video to show it.

https://autode.sk/3O6dUxF

In this video here are one "A" entity. It have 3 "B" entities. All "B" entities have 5 "C" entities each. So, here are 19 entities. All of them place in same group.

I have overridden this methods:

 

//*************************************************************************
    // Overridden methods from AcDbObject
    //*************************************************************************
    virtual Acad::ErrorStatus dwgInFields( AcDbDwgFiler * ) override;
    virtual Acad::ErrorStatus dwgOutFields( AcDbDwgFiler * ) const override;
    virtual Acad::ErrorStatus dxfInFields( AcDbDxfFiler * ) override;
    virtual Acad::ErrorStatus dxfOutFields( AcDbDxfFiler * ) const override;

    //*************************************************************************
    // Overridden methods from AcDbEntity
    //*************************************************************************
    Adesk::Boolean subWorldDraw( AcGiWorldDraw * pWd );
    virtual Acad::ErrorStatus subGetOsnapPoints(
        AcDb::OsnapMode       osnapMode,
        Adesk::GsMarker       gsSelectionMark,
        const AcGePoint3d & pickPoint,
        const AcGePoint3d & lastPoint,
        const AcGeMatrix3d & viewXform,
        AcGePoint3dArray & snapPoints,
        AcDbIntArray &         /*geomIds*/ ) const override;
    virtual Acad::ErrorStatus subGetGripPoints( AcGePoint3dArray & gripPoints,
        AcDbIntArray & osnapMasks, AcDbIntArray & geomIds ) const override;
    virtual Acad::ErrorStatus subMoveGripPointsAt( const AcDbIntArray & indices, const AcGeVector3d & offset ) override;
    virtual Acad::ErrorStatus subGetTransformedCopy( const AcGeMatrix3d & xform, AcDbEntity *& ent ) const override;
    virtual Acad::ErrorStatus subTransformBy( const AcGeMatrix3d & xform ) override;
    virtual Acad::ErrorStatus subGetGeomExtents( AcDbExtents & extents ) const override;
    virtual Acad::ErrorStatus subExplode( AcDbVoidPtrArray & entitySet ) const override;
    virtual Acad::ErrorStatus subDeepClone( AcDbObject * pOwnerObject,
        AcDbObject *& pClonedObject,
        AcDbIdMapping & idMap,
        Adesk::Boolean isPrimary = true ) const;

    virtual Acad::ErrorStatus subWblockClone( AcRxObject * pOwnerObject,
        AcDbObject *& pClonedObject,
        AcDbIdMapping & idMap,
        Adesk::Boolean isPrimary = true ) const;

 

subGetGripPoints, subMoveGripPointsAt, subGetTransformedCopy, subTransformBy, subExplode, subDeepClone and subWblockClone just return Acad::eOk or Acad::eNotApplicable because I don't want to let user copy them or move them.

 

0 Likes
Accepted solutions (1)
1,485 Views
7 Replies
Replies (7)
Message 2 of 8

DonatasAzaravicius
Advocate
Advocate

P.S.

why can't I add video directly to post?

I tried to add video from my screencast selection (below message box) but trying to save get this error

DonatasAzaravicius_0-1649788121899.png

 

0 Likes
Message 3 of 8

tbrammer
Advisor
Advisor

It is hard to tell what might go wrong without knowing how your custom entities worldDraw() is implemented and what your SETDHPROJECTEXAGGERATE command actually does. Can you provide a buildable sample plus the DWG from the screencast?

 

Could it be that you have unbalanced AcGiGeometry::pushModelTransform()/popModelTransform() calls?

 

Videos should be attached as screencast links as you did. So people can view them without downloading. Besides that a screencast can show what you are typing and clicking during recording which might be important.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 4 of 8

DonatasAzaravicius
Advocate
Advocate

My subWorldDraw have just 3 lines.

Adesk::Boolean DATB::Stratum::subWorldDraw( AcGiWorldDraw * pWd )
{
    assertReadEnabled();
    pWd->geometry().draw( &mSolid );
    return Adesk::kTrue;
}

My solid is created with this function

void DATB::Stratum::createSolid()
{
    AcGeMatrix3d matTrans;
    matTrans.setToTranslation( AcGeVector3d( mInsertion.x, mInsertion.y, mInsertion.z * mExag ) );

    mSolid.createFrustum( (mDepthTo - mDepthFrom) * mExag, 1.0, 1.0, 1.0 );
    mSolid.transformBy( matTrans );
}

 

SETDHPROJECTEXAGGERATE just sets mExag variable using method

Acad::ErrorStatus DATB::Stratum::setExaggerate( double exag )
{
    assertWriteEnabled();
    mExag = exag;
    this->createSolid();
    return Acad::eOk;
}

 

DWG is just empty dwg. I have used lisp and hard coded entity creation for testing.

 

I just need to draw cylinder, so I started to wander if I could drop AcDb3dSolid from my code and just draw it using AcGiWorldDraw. It would be easy to draw Wireframe view as it only needs 2 circles and 4 vertical lines, but how should I draw round cylinder like AcDb3dSolid in Conceptual view?

I have replaced AcDbText with 

pWd->geometry().text( origin, normal, direction, 2.5, 1.0, 0.0, mCode.kwszPtr() );

And it works better because I can rotate text if view direction change.

0 Likes
Message 5 of 8

DonatasAzaravicius
Advocate
Advocate

P.S.

I think AutoCAD saves graphics at creation and use it letter to draw entity if I change view direction. I wan playing with my text.

I have create it with normal(0.0, 0.0, 1.0) direction(1.0, 0.0, 0.0)

If I rotated view text would use this values, after I exit view change command text would be flat on screen. If I enter view change command and rotate view text again would be on xy plane. But at some point text was at some different plane and not on original xy plane. I think AutoCAD saved dwg to temp files and started to use new saved graphics than I rotate view direction. This may be problem in my video too.

0 Likes
Message 6 of 8

tbrammer
Advisor
Advisor
Accepted solution
It looks like the graphic system caches the graphics of mSolid for different shademodes.
Try to call mSolid.recordGraphicsModified() in DATB::Stratum::createSolid().
Maybe this will invalidate the cache for mSolid.
 
Or change the type of mSolid from AcDb3dSolid to a AcDb3dSolid* pointer and (re)create
a new AcDb3dSolid in createSolid().
 
Also have a look at this posting.

Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 7 of 8

DonatasAzaravicius
Advocate
Advocate

Thanks for reply.

0 Likes
Message 8 of 8

ChengboZhang
Enthusiast
Enthusiast

very nice dbx entity; 
and  how to  solved the display issue?

0 Likes