changing the lineweight of an entity.

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
mrhickman53
Junior Member
Posts: 17
Joined: Thu Sep 07, 2023 1:17 am

changing the lineweight of an entity.

Post by mrhickman53 » Wed Mar 27, 2024 9:11 pm

Version:
3.29.4.0 (3.29.4)
Internet:
QCAD.org
Build Date:
Feb 7 2024
Revision:
36a6423
Qt Version:
5.8.0
Architecture:
x86_64
Compiler:
gcc 4.8.1

I am trying to change the lineweight of several entities, starting with the circle described below. The debug statement indicates the lineweight is being changed but the circle gets added to the document with RLineweight.ByLayer. What am I missing?

Thanks.

Code: Select all

 
    circleEntity = shapeToEntity( this.doc, mycircle );
    circleEntity.setLineweight( RLineweight.Weight100 );
    qDebug( 'circleEntity.getLineweight() = ', circleEntity.getLineweight(), circleEntity.getLineweight() == RLineweight.Weight100 );
    op.addObject( circleEntity );
    //op.addObject( shapeToEntity(this.doc, circle) );
    op.addObject( myleaderEntity );
    //op.addObject( leaderEntity );
    this.di.applyOperation(op);

User avatar
andrew
Site Admin
Posts: 9063
Joined: Fri Mar 30, 2007 6:07 am

Re: changing the lineweight of an entity.

Post by andrew » Wed Mar 27, 2024 10:21 pm

RAddObjectsOperation::addObject uses the current attributes by default. You can disable this default behaviour by passing false as second argument (useCurrentAttributes):

Code: Select all

op.addObject(circleEntity, false);

mrhickman53
Junior Member
Posts: 17
Joined: Thu Sep 07, 2023 1:17 am

Re: changing the lineweight of an entity.

Post by mrhickman53 » Thu Mar 28, 2024 12:15 am

Thanks. I did not understand the use of the "current attributes" flag.

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: changing the lineweight of an entity.

Post by CVH » Thu Mar 28, 2024 8:03 am

mrhickman53,

If considered as solved then please add [Solved] to the title of your initial post by editing it.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”