yesterday
I created a 2D faucet in plan based on a product my firm uses often. The object is parametric and seems to work well, but for some reason the fills aren't showing up when I place the object. I've tried simplifying the code and other things but nothing has worked so far. Can anyone spot the problem?
I also keep getting a warning about an uninitialized variable where my hotspots are but I can't figure out what it means. Everything works find in spite of it so I've just ignored it but if anyone can tell my why that happens it would be nice to get rid of it.
The .gsm file is attached
yesterday
I created a 2D faucet in plan based on a product my firm uses often. The object is parametric and seems to work well, but for some reason the fills aren't showing up when I place the object. I've tried simplifying the code and other things but nothing has worked so far. Can anyone spot the problem?
I also keep getting a warning about an uninitialized variable where my hotspots are but I can't figure out what it means. Everything works find in spite of it so I've just ignored it but if anyone can tell my why that happens it would be nice to get rid of it.
The .gsm file is attached
Operating system used: Mac Apple Silicon
yesterday
Update: I called the object into a different sink object and it looks like the fill works there. So when I place the faucet, the fills don't show up, but they do when it's nested into another object. No idea why
yesterday
1. You have to initialize the variable unid.
2. The POLY2_B command needs a contoiur pen, a foreground pen and a baclground pen
!==============================================================================================================================
! *** 2D SCRIPT ***
!==============================================================================================================================
unID = 1 ! Initialize
GOSUB "Drawing" ! GOSUB: Starts subroutine. Once subroutine complete, continues with whatever immediately follows
GOSUB "Hotspots" ! Subroutine titles are case sensitive
END
!==============================================================================================================================
"Drawing":
! Handles
FOR i = 1 to 2
ADD2 originA_x, 0
PEN pen_outline
FILL fill_bg
POLY2_B{5} 17, 2, 0, 3, pen_fgfill, pen_bgfill,
0, 0, 1, 0, 0, 1, 0,
0.0298326671144, -0.0068918278709, 1,
0.0284493693835, -5.581108646999E-17, 900,
0, 157.3012922772, 4001,
1.249000902703E-16, -8.326672684689E-17, 900,
0, 63.98390375907, 4001,
-6.38875977883E-16, 0.0284493693835, 900,
0, 157.3012922772, 4001,
6.245004513517E-17, -5.551115123126E-17, 900,
0, 63.98390375907, 4001,
-0.0284493693835, -4.972432474436E-17, 900,
0, 157.3012922772, 4001,
2.324529457809E-16, -2.775557561563E-16, 900,
0, 63.98390375907, 4001,
6.243018177651E-16, -0.0284493693835, 900,
0, 157.3012922772, 4001,
3.295974604356E-16, 6.522560269673E-16, 900,
0, 63.98390375906, 4001
PEN pen_outline
LINE2 0.01530919101848, -0.02651629666678, 0.007595400926965, -0.01315562030936
LINE2 -0.01530919101848, -0.02651629666678, -0.007595400926965, -0.01315562030936
LINE2 0.01530919101848, 0.02651629666678, 0.007595400926965, 0.01315562030936
LINE2 -0.01530919101848, 0.02651629666678, -0.007595400926965, 0.01315562030936
CIRCLE2 0, 0, 0.009734798947775
PEN pen_detail
ARC2 6.676283209562E-16, 1.734723475977E-18, 0.01519080185393, 60.95324306666, 119.0467569239
ARC2 6.676283209562E-16, -4.45823933326E-16, 0.01519080185393, 240.9532430761, 299.0467569333
ARC2 0, 7.119082674925E-16, 0.01519080185393, 330.9532430761, 29.04675693334
ARC2 -1.734723475977E-18, 6.233483743829E-16, 0.01519080185393, 150.9532430667, 209.0467569239
PEN pen_gen
ARC2 2.359223927328E-16, -2.081668171172E-16, 0.03061838203695, 193.0080481205, 256.9919518795
ARC2 5.551115123126E-17, 3.469446951954E-18, 0.03061838203695, 103.0080481205, 166.9921875
ARC2 3.365363543395E-16, 6.869504964868E-16, 0.03061838203695, 283.0080481205, 346.9919518795
ARC2 1.179611963664E-16, -1.734723475977E-17, 0.03061838203695, 13.00804812047, 76.99195187953
ARC2 -2.896988204881E-16, -4.735795089417E-16, 0.01519080185393, 299.0467569338, 330.9532430663
ARC2 -0.0284493693835, 0, 0.007029281898917, 50.46496844912, 309.5350315509
ARC2 -0.01943503188228, 0.01081749055387, 0.007051938388913, 229.9262438482, 330.7846643184
ARC2 -0.01943503188229, -0.01081749055388, 0.007051938388914, 29.21533568155, 130.0737561518
ARC2 0.0284493693835, 0, 0.007029281898917, 230.4649684491, 129.5350315509
ARC2 0.01943503188228, 0.01081749055387, 0.007051938388913, 209.2153356816, 310.0737561518
ARC2 0.01943503188229, -0.01081749055388, 0.007051938388914, 49.92624384822, 150.7846643184
ARC2 -6.273567877233E-16, 0.0284493693835, 0.007029281898916, 320.4649684491, 219.5350315509
ARC2 -0.01081749055388, 0.01943503188228, 0.007051938388913, 299.2153356816, 40.07375615181
ARC2 0.01081749055388, 0.01943503188229, 0.007051938388914, 139.9262438482, 240.7846643184
ARC2 6.273567877233E-16, -0.0284493693835, 0.007029281898917, 140.4649684491, 39.53503155088
ARC2 -0.01081749055388, -0.01943503188228, 0.007051938388914, 319.9262438482, 60.78466431841
ARC2 0.01081749055388, -0.01943503188229, 0.007051938388914, 119.2153356816, 220.0737561518
ARC2 -2.359223927328E-16, 2.081668171172E-16, 0.01519080185393, 209.0467569338, 240.9532430757
ARC2 1.144917494145E-16, 4.336808689942E-16, 0.01519080185393, 29.04675693368, 60.95324306617
ARC2 1.110223024625E-16, 0, 0.01519080185393, 119.0467569243, 150.9532430662
DEL 1
MUL2 -1, 1 ! Flip along y axis
NEXT i
DEL 1
! Faucet
PEN pen_bgfill
FILL fill_bg
poly2_b{5} 18, 2, 0, 3, pen_bgfill, pen_bgfill,
0, 0, 1, 0, 0, 1, 0,
-0.01623766504311, -0.02561453208883, 1,
-0.537095588509, -0.08245239130504, 900,
0, -6.845603631673, 4001,
-0.0131761393639, -0.1154058947509, 1,
-0.0639761393639, -0.1154058947509, 900,
0, -16.83319405587, 4001,
1.075528555106E-16, -0.1347618799681, 900,
0, 76.94988747681, 4001,
0.007991747506241, -0.1486693299371, 1,
-1.856154119295E-16, -0.1347618799681, 900,
0, 76.94988747681, 4001,
0.0639761393639, -0.1154058947509, 900,
0, -16.83319405587, 4001,
0.0131761393639, -0.08810300941003, 1,
0.537095587228, -0.0824523912765, 900,
0, -6.845603684991, 4001,
-2.418513106279E-10, 2.532696274926E-16, 900,
0, 295.2568222094, 4001
PEN 116
line2 0.0151638226389, 0.02626451124753, 0.008498884534129, 0.01472049982077
line2 -0.0151638226389, 0.02626451124753, -0.008498884534129, 0.01472049982077
line2 0.0303276452778, 4.440892098501E-16, 0.01699776906826, 4.440892098501E-16
line2 -0.0303276452778, 4.440892098501E-16, -0.01699776906826, 0
line2 0.007991747506241, -0.01500187071982, 0.007991747506241, -0.1413261010278
line2 -0.007991747506241, -0.01500187071982, -0.007991747506241, -0.1413261010278
PEN pen_detail
circle2 0, 0, 0.01699776906826
PEN pen_gen
line2 -0.0131761393639, -0.08810300941003, -0.0131761393639, -0.1154058947509
line2 0, -0.01141572445601, 0.009886307381506, -0.005707862228004
line2 0.009886307381506, -0.005707862228004, 0.009886307381506, 0.005707862228003
line2 0.009886307381506, 0.005707862228003, 0, 0.01141572445601
line2 0, -0.01141572445601, -0.009886307381506, -0.005707862228004
line2 -0.009886307381506, -0.005707862228004, -0.009886307381506, 0.005707862228003
line2 -0.009886307381506, 0.005707862228003, 0, 0.01141572445601
line2 -0.007991747506241, -0.1486693299371, 0.007991747506241, -0.1486693299371
line2 0.0131761393639, -0.08810300941003, 0.0131761393639, -0.1154058947509
arc2 -2.401474709209E-10, 4.440892098501E-16, 0.03032764449781, 302.3715892617, 237.6284119023
arc2 9.887923813068E-17, -0.1347618799681, 0.01604011199599, 163.1668059441, 240.1166934209
arc2 -1.734723475977E-16, -0.1347618799681, 0.01604011199599, 299.8833065791, 16.83319405587
arc2 -0.0639761393639, -0.1154058947509, 0.0508, 343.1668059441, 0
arc2 0.0639761393639, -0.1154058947509, 0.0508, 180, 196.8331940559
spline2a 5, 2,
-0.0131761393639, -0.08810300941003, 0, 0, 0,
-0.01410791602692, -0.05059234526156, 92.76644073273, 0.01876327874899, 0.009216552006776,
-0.01655603939302, -0.02306938484144, 97.33328849111, 0.009214840497899, 0.002755249698397,
-0.01859624398453, -0.01514827955904, 117.9059295097, 0.002744654538537, 0.003109418794022,
-0.0225475002714, -0.01038678763256, 0, 2.22044604925E-16, 0
spline2a 5, 2,
0.0131761393639, -0.08810300941003, 0, 0, 0,
0.01410791602692, -0.05059234526156, 87.23355926727, 0.01876327874899, 0.009216552006776,
0.01655603939302, -0.02306938484144, 82.66671150889, 0.009214840497899, 0.002755249698397,
0.01859624398453, -0.01514827955904, 62.09407049026, 0.002744654538537, 0.003109418794022,
0.0225475002714, -0.01038678763256, 0, 2.22044604925E-16, 0
RETURN
!==============================================================================================================================
"Hotspots":
! Handle Hotspot
FOR i = 1 to 2
unID=unID+1 : HOTSPOT2 0, 0, unID, originA_x, 1 ! Base Hotspot 1: base, 128: hidden
unID=unID+1 : HOTSPOT2 originA_x, 0, unID, originA_x, 2, originA_x ! Moving Hotspot 2: moving
unID=unID+1 : HOTSPOT2 -1, 0, unID, originA_x, 3 ! Reference Hotspot 3: reference
MUL2 -1, 1 ! Flip along y axis
NEXT i
DEL 1
RETURN
!==============================================================================================================================
! *** END 2D SCRIPT ***
!==============================================================================================================================
12 hours ago
Perfect, uninitialized variable fixed.
I have the contour pen for the fills (pen_bgfill) set to 91, which is the same as the foreground and background pens. It means the outline will be white but it is still technically set. I tried changing it like you suggested but it didn't fix the problem. I have tried copying the exact code for the POLY command into another object and it worked just fine, but for some reason still doesn't in this object.
11 hours ago
1/ You used the same pen for backgroundpen and the foregroundpen, you'll have to add a new parameter like pen_vgfill
2/ The Uninitialize variable is:
11 hours ago - last edited 11 hours ago
The syntax of the POLY2_B{5} is the following:
PEN pen_outline
POLY2_B{5} number_of_nodes, frame_fill, fillcategory, distortion_flags, fill_pen, fill_background_pen, ....
where pen_outline is the contour pen, fill_pen ist the fill's foreground pen and fill_background_pen the fill's background pen, which could be zero (transparent) or - 1 (drawing background).
All the other pens are not allowed to have values below 1.
If you do not want to show the outline with a pen, you should set the Value of frame fill different.
frame_fill = j1 + 2*j2 + 4*j3, where each j can be 0 or 1.
j1: draw contour
j2: draw fill
j3: close an open polygon.
I haven't checked it, but ist seems that you have the value 2 as framefill which wil not show any contour line.
If you use the value 7, all outlines and fills are shown and you can set the contour pen to white.
11 hours ago
The value for frame fill is already set to 2 so that the contour is not drawn. The variable for both the background fill and foreground fill pens is set to 91, so they should work just fine. I’ve used these same variables in other objects and the fill appeared as intended so I don’t think the problem is with the pens I chose. I tried changing those variables and even replacing them with just regular values but for some reason the fill isn’t being drawn when the object is placed. There may be some setting or something outside of the 2D script that I’m missing but I the 2D script should work