Problems with defining an RPatternLine object

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 4997
Joined: Wed Sep 27, 2017 4:17 pm

Problems with defining an RPatternLine object

Post by CVH » Sat Nov 29, 2025 8:06 pm

Andrew,

An RHatchData object lets me set a custom pattern:

Code: Select all

hatchData.setCustomPattern(specialPattern);
specialPattern is an RPattern object.

Code: Select all

specialPattern = new RPattern("myPattern", "My custom pattern");
I then need to add the line definitions of this pattern with addPatternLine(patternLine1)
patternLine1 is an RPatternLine object.

Code: Select all

patternLine1 = new RPatternLine();
I should now be able to specify: patternLine1.angle, patternLine1.basePoint, patternLine1.offset and patternLine1.dashes ...
There are getters but no setter methods to change these attributes.

Supposing we must change them in direct.
But this fails silent or critical for these Public Attributes.

I can convert patternLine1 to text with .toString() and then I get:

Code: Select all

RPatternLine( angle:3.15381e-316 base:"RVector(0.000000, 0.000000, 0.000000, 1)" offset:"RVector(0.000000, 0.000000, 0.000000, 1)") 
Here angle is something very small and in degrees ... Its never twice the same value
base is basePoint as RVector and offset is also an RVector ... Both the default nullVector.
There are yet no dashes to list.

Changing the angle attribute is ignored.
Specifying a vector for basePoint or offset is ignored.
Specifying X & Y of these vector attributes fails critical.
  • TypeError: Result of expression 'patternLine.basePoint' [undefined] is not an object.
    TypeError: Result of expression 'patternLine.offset' [undefined] is not an object.

How should we define an RPattern object .... :?:

Perhaps I am able to 'steel' line definitions (RPatternLine) from a standard pattern and use scale/rotate ...

Regards,
CVH

Post Reply

Return to “QCAD Troubleshooting and Problems”