Added trim for U and V directions when trimming happens sequentially in these directions.
Added possibility to set sense to trim command.
This allows using arbitrary Unicode symbols for localization of messages.
Existing message files containing 8-bit characters (previously interpreted as characters from Latin-1 code block) should be converted to UTF-8.
+
+@section upgrade_occt760 Upgrade to OCCT 7.6.0
+
+@subsection upgrade_760_trimming_surface Trimming surface
+
+Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim.
+For example:
+~~~~~
+ Handle(Geom_RectangularTrimmedSurface) ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U
+ Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V
+~~~~~
+gives different result.
+In current version ST1 - surface trimmed only along V, U trim is removed;
+After modification ST1 - surface trimmed along U and V, U trim is kept.
Syntax:
~~~~~
-trim newname name [u1 u2 [v1 v2]]
-trimu newname name
-trimv newname name
+trim newname name [u1 u2 [v1 v2] [usense vsense]]
+trimu newname name u1 u2 [usense]
+trimv newname name v1 v2 [vsense]
~~~~~
The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package.
S = new RectangularTrimmedSurface (basisSurf,
utrim1 , utrim2,
vtrim1 , vtrim2,
- Standard_True , Standard_True );
+ Standard_True, Standard_True);
else if ( isutrimmed)
S = new RectangularTrimmedSurface (basisSurf,
utrim1 , utrim2,
- Standard_True, Standard_True );
+ Standard_True, Standard_True);
else if (isvtrimmed)
S = new RectangularTrimmedSurface (basisSurf,
vtrim1 , vtrim2,
- Standard_False , Standard_True );
+ Standard_False , Standard_True);
return S;
}
const Standard_Boolean UTrim,
const Standard_Boolean Sense
) {
-
// kill trimmed basis surfaces
Handle(Geom_RectangularTrimmedSurface) T =
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
basisSurf = new Geom_OffsetSurface(S2, O->Offset(), Standard_True);
}
+ if (!T.IsNull())
+ {
+ if (UTrim && T->isvtrimmed)
+ {
+ SetTrim(Param1, Param2, T->vtrim1, T->vtrim2, Sense, Standard_True);
+ return;
+ }
+ else if (!UTrim && T->isutrimmed)
+ {
+ SetTrim(T->utrim1, T->utrim2, Param1, Param2, Standard_True, Sense);
+ return;
+ }
+ }
+
SetTrim(Param1, Param2, UTrim, Sense);
}
const Standard_Real V2,
const Standard_Boolean USense,
const Standard_Boolean VSense ) {
-
SetTrim( U1, U2, V1, V2, Standard_True, Standard_True, USense, VSense);
}
Standard_Boolean dummy_Sense = Standard_True;
if ( UTrim) {
- SetTrim( Param1 , Param2 ,
- dummy_a , dummy_b ,
- Standard_True , Standard_False,
- Sense , dummy_Sense );
+ if (isvtrimmed)
+ {
+ SetTrim (Param1, Param2,
+ vtrim1, vtrim2,
+ Standard_True, Standard_True,
+ Sense, dummy_Sense);
+ }
+ else
+ {
+ SetTrim (Param1, Param2,
+ dummy_a, dummy_b,
+ Standard_True, Standard_False,
+ Sense, dummy_Sense);
+ }
}
else {
- SetTrim( dummy_a , dummy_b ,
- Param1 , Param2 ,
- Standard_False, Standard_True,
- dummy_Sense , Sense );
+ if (isutrimmed)
+ {
+ SetTrim (utrim1, utrim2,
+ Param1, Param2,
+ Standard_True, Standard_True,
+ dummy_Sense, Sense);
+ }
+ else
+ {
+ SetTrim (dummy_a, dummy_b,
+ Param1, Param2,
+ Standard_False, Standard_True,
+ dummy_Sense, Sense);
+ }
}
}
Standard_Real u1 = Draw::Atof(a[3]);
Standard_Real u2 = Draw::Atof(a[4]);
+ Standard_Real v1 = 0., v2 = 0.;
+ Standard_Boolean USense = Standard_True, VSense = Standard_True;
+
Handle(Geom_Geometry) result;
Handle(Geom2d_Curve) result2d;
if (!strcasecmp(a[0],"trim")) {
if (!GS.IsNull()) {
if (n<7) return 1;
+ v1 = Draw::Atof(a[5]);
+ v2 = Draw::Atof(a[6]);
+ if (n > 7)
+ {
+ USense = *a[7] != '0';
+ VSense = *a[8] != '0';
+ }
result =
- new Geom_RectangularTrimmedSurface(GS,u1,u2,Draw::Atof(a[5]),Draw::Atof(a[6]));
+ new Geom_RectangularTrimmedSurface(GS, u1, u2, v1, v2, USense, VSense);
}
else if (!GC.IsNull()) {
- result = new Geom_TrimmedCurve(GC, u1, u2);
+ if (n>5)
+ {
+ USense = *a[5] != '0';
+ }
+ result = new Geom_TrimmedCurve(GC, u1, u2, USense);
}
else if (!GC2d.IsNull()) {
- result2d = new Geom2d_TrimmedCurve(GC2d, u1, u2);
+ if (n > 5)
+ {
+ USense = *a[5] != '0';
+ }
+ result2d = new Geom2d_TrimmedCurve(GC2d, u1, u2, USense);
}
else
return 1;
}
else {
if (GS.IsNull()) return 1;
- result = new Geom_RectangularTrimmedSurface(GS,u1,u2,
- !strcasecmp(a[0],"trimu"));
+ Standard_Boolean Utrim = !strcasecmp(a[0], "trimu");
+ if (n > 5)
+ USense = *a[5] != '0';
+ result = new Geom_RectangularTrimmedSurface(GS, u1, u2, Utrim, USense);
}
if (!result.IsNull())
offseting,g);
theCommands.Add("trim",
- "trim newname name [u1 u2 [v1 v2]], no args remove trim",
+ "trim newname name [u1 u2 [v1 v2] [usense=1 vsense=1]]"
+ "\n\t\t: Creates either a new trimmed curve from a curve"
+ "\n\t\t: or a new trimmed surface in u and v from a surface."
+ "\n\t\t: Removes trim when called without arguments."
+ "\n\t\t: - u1 u2 lower and upper parameters of trimming on U direction"
+ "\n\t\t: - v1 v2 lower and upper parameters of trimming on V direction"
+ "\n\t\t: - usense vsense senses on U and V directions: 1 - true, 0 - false;"
+ "\n\t\t Senses are used for the construction only if the surface is periodic"
+ "\n\t\t in the corresponding parametric direction, and define the available part of the surface",
__FILE__,
trimming,g);
theCommands.Add("trimu",
- "trim newname name u1 u2",
+ "trimu newname name u1 u2 [usense=1]"
+ "\n\t\t: Creates a u-trimmed surface."
+ "\n\t\t: - u1 u2 lower and upper parameters of trimming on U direction"
+ "\n\t\t: - usense sense on U direction: 1 - true, 0 - false;"
+ "\n\t\t usense is used for the construction only if the surface is u-periodic"
+ "\n\t\t in the u parametric direction, and define the available part of the surface",
__FILE__,
trimming,g);
theCommands.Add("trimv",
- "trim newname name v1 v2",
+ "trimv newname name v1 v2 [vsense=1]"
+ "\n\t\t: Creates a v-trimmed surface."
+ "\n\t\t: - u1 u2 lower and upper parameters of trimming on V direction"
+ "\n\t\t: - vsense sense on V direction: 1 - true, 0 - false;"
+ "\n\t\t vsense is used for the construction only if the surface is v-periodic"
+ "\n\t\t in the v parametric direction, and define the available part of the surface",
__FILE__,
trimming,g);
--- /dev/null
+puts "=========="
+puts "0030342: Modeling Data - Successively trimming surface in both directions lose the first trim"
+puts "=========="
+puts ""
+
+cylinder c1 10
+
+trim c3 c1 0 3.14 0 50
+set expected [dump c3]
+
+trimu c2 c1 0 3.14
+trimv c3 c2 0 50
+
+set result [dump c3]
+if { [string compare $expected $result] != 0 } {
+ puts "Error: invalid result"
+}
--- /dev/null
+puts "=========="
+puts "0030342: Modeling Data - Successively trimming surface in both directions lose the first trim"
+puts "=========="
+puts ""
+
+torus t 1 0.5
+
+trim t2 t 0 2 0 4 0 0
+set expected [dump t2]
+
+trimu t1 t 0 2 0
+trimv t2 t1 0 4 0
+
+set result [dump t2]
+if { [string compare $expected $result] != 0 } {
+ puts "Error: invalid result"
+}