SmartPart, polyline problem: Fill vs Pattern [Решен]


Hi!

I found something strange using pattern, when I combine filled polylines and polylines with patterns.

In this sample, I create one polyline filled, and inside this polyline, one other polyline for the pattern. When the script run and create the first pattern (pattern inside the left rectangle), it created perfect, but when the script create the second pattern (pattern inside the right rectangle), doesn't do it correctly, and erase the fill.

This the script:

!-------------Rectangle left
GOSUB "rectangle"
!-------------Rectangle right
TRANS2 REF_X , 0
GOSUB "rectangle"
RESTORE 1
END

"rectangle":
Fill 28
PUT REF_X / 2 , 0 , 15 ,
0 , 0 , 15 ,
0 , REF_Y , 15 ,
REF_X / 2 , REF_Y , 15
POLY2_ NUM_SP / 3 , 1 + 2 + 4 , GET ( NUM_SP ) !---polylines

DEFINE PATTERN "pattern_1" fill_patt , 1 , 0 , 0.02 , 0.02 , REF_X / 2 , 0.25 , 2
PATTERN "pattern_1"
PUT REF_X / 2 , 0.25 , 15 ,
0.12 , 0.25 , 15 ,
0.12 , REF_Y - 0.12 , 15 ,
REF_X / 2 , REF_Y - 0.12 , 15
POLY2_ NUM_SP / 3 , 1 + 2 + 4 , GET ( NUM_SP ) !---Pattern

RETURN

Thanks!

Xavier Coll • Architect, Project Manager I+D, BIM Manager, BIM Auditor
EiPM • http://www.eipm.es/en/

Вложения (1)

Type: image/jpeg
Загружено 436 раз
Size: 174,59 KiB

Show most helpful answer Hide most helpful answer

Hello,

in general you can define several "InFills" for a polyline:
1.FaceStyle
2.Bitmap
3.Pattern
4.Hatching
5.Filling

If a POLY2_-Command occurs, then the InFill with the highest priority win's!
In your example after the first fill/pattern the state is following:
Pattern=301
Fill=28

At this position the Pattern wins, because it has a higher priority!

If you reset the Pattern to 0 after the first pattern with command
PATTERN 0
then it works correctly!

Another workaround could be, to create first the fillings, and then the patterns.
(You save a double definition of pattern)...

We will check, if we could solve the problem in the way, YOU think that it works...

Regards Jörg

I found the solution, but I don't like it: The trick is to create the patterns at the end of the script.

This is the script solution:

!-------------Rectangle left
GOSUB "rectangle_draw"
!-------------Rectangle right
TRANS2 REF_X , 0
GOSUB "rectangle_draw"
RESTORE 1

!-------------Pattern left
GOSUB "pattern_draw"
!-------------Pattern right
TRANS2 REF_X , 0
GOSUB "pattern_draw"
RESTORE 1
END

"rectangle_draw":
FILL 28
PUT REF_X / 2 , 0 ,
0 , 0 ,
0 , REF_Y ,
REF_X / 2 , REF_Y
POLY2 NUM_SP / 3 , 1 + 2 + 4 , GET ( NUM_SP ) !---polylines
RETURN

"pattern_draw":
DEFINE PATTERN "pattern_1" fill_patt , 1 , 0 , 0.02 , 0.02 , REF_X / 2 , 0.25 , 2
PATTERN "pattern_1"
PUT REF_X / 2 , 0.25 ,
0.12 , 0.25 ,
0.12 , REF_Y - 0.12 ,
REF_X / 2 , REF_Y - 0.12
POLY2 NUM_SP / 3 , 1 + 2 + 4 , GET ( NUM_SP ) !---Pattern
RETURN

Xavier Coll • Architect, Project Manager I+D, BIM Manager, BIM Auditor
EiPM • http://www.eipm.es/en/

Вложения (1)

Type: image/jpeg
Загружено 401 раз
Size: 165,91 KiB

Hello,

in general you can define several "InFills" for a polyline:
1.FaceStyle
2.Bitmap
3.Pattern
4.Hatching
5.Filling

If a POLY2_-Command occurs, then the InFill with the highest priority win's!
In your example after the first fill/pattern the state is following:
Pattern=301
Fill=28

At this position the Pattern wins, because it has a higher priority!

If you reset the Pattern to 0 after the first pattern with command
PATTERN 0
then it works correctly!

Another workaround could be, to create first the fillings, and then the patterns.
(You save a double definition of pattern)...

We will check, if we could solve the problem in the way, YOU think that it works...

Regards Jörg

Thanks a lot Jörg!

Then, applying the right solution that explains Jörg, the script works properly and is less long than my "solution" :-D . Then, the final script would be:

!-------------Rectangle left
GOSUB "rectangle"
!-------------Rectangle right
TRANS2 REF_X , 0
GOSUB "rectangle"
RESTORE 1
END

"rectangle":
FILL 28
PUT REF_X / 2 , 0 , 15 ,
0 , 0 , 15 ,
0 , REF_Y , 15 ,
REF_X / 2 , REF_Y , 15
POLY2_ NUM_SP / 3 , 1 + 2 + 4 , GET ( NUM_SP ) !---polylines

DEFINE PATTERN "pattern_1" fill_patt , 1 , 0 , 0.02 , 0.02 , REF_X / 2 , 0.25 , 2
PATTERN "pattern_1"
PUT REF_X / 2 , 0.25 , 15 ,
0.12 , 0.25 , 15 ,
0.12 , REF_Y - 0.12 , 15 ,
REF_X / 2 , REF_Y - 0.12 , 15
POLY2_ NUM_SP / 3 , 1 + 2 + 4 , GET ( NUM_SP ) !---Pattern
PATTERN 0

RETURN

Regards, Xavi

Xavier Coll • Architect, Project Manager I+D, BIM Manager, BIM Auditor
EiPM • http://www.eipm.es/en/