From: Martin Siggel Date: Thu, 28 Apr 2016 11:33:57 +0000 (+0300) Subject: 0027447: Add support for long IGES entity names X-Git-Tag: V7_0_winwerth~2 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=6f21399c0d3cf5b02e2cba2c2d4840f833548184;p=occt-copy.git 0027447: Add support for long IGES entity names Adding support for long IGES names. The method IGESCAFControl_Writer::WriteNames is now extended to also write IGES 406 / 15 name entities containing the full label name. Test case for issue #27447 --- diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.cxx b/src/IGESCAFControl/IGESCAFControl_Writer.cxx index 4134fa96b8..65aa2b97c0 100644 --- a/src/IGESCAFControl/IGESCAFControl_Writer.cxx +++ b/src/IGESCAFControl/IGESCAFControl_Writer.cxx @@ -21,10 +21,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -526,6 +528,14 @@ Standard_Boolean IGESCAFControl_Writer::WriteNames (const TDF_LabelSequence& the anAsciiName->SetValue (aNameLength+1, IsAnAscii (aName.Value (aCharPos)) ? (Standard_Character )aName.Value (aCharPos) : '?'); } anIGESEntity->SetLabel (anAsciiName); + + // Set long IGES name using 406 form 15 entity + Handle(IGESBasic_Name) aLongNameEntity = new IGESBasic_Name; + Handle(TCollection_HExtendedString) aTmpStr = new TCollection_HExtendedString(aName); + aLongNameEntity->Init(1, new TCollection_HAsciiString(aTmpStr, '_')); + + anIGESEntity->AddProperty(aLongNameEntity); + AddEntity(aLongNameEntity); } } diff --git a/tests/bugs/xde/bug27447 b/tests/bugs/xde/bug27447 new file mode 100644 index 0000000000..b8d0a5c5ac --- /dev/null +++ b/tests/bugs/xde/bug27447 @@ -0,0 +1,47 @@ +puts "========" +puts "OCC27447" +puts "========" +puts "" +########################################## +# Add support for long IGES entity names +########################################## + +pload OCAF + +# Part of samples/tcl/xde.tcl +pcylinder pin 1 10 +pcylinder nut 2 2 +compound nut nut nuts +explode nuts +ttranslate nuts_1 0 0 7 +ttranslate nuts_2 0 0 1 +compound pin nuts_1 nuts_2 link +NewDocument D XCAF +XAddShape D link +SetName D [XFindShape D pin] "Pin" +SetName D [XFindShape D nut] "Nut" +# Modification of label "Link" to "Very long link name" according to bug's description +SetName D [XFindShape D link] "Very long link name" +SetName D [XFindShape D link]:1 "Pin instance" +SetName D [XFindShape D link]:2 "Nut instance 1" +SetName D [XFindShape D link]:3 "Nut instance 2" + +# Write IGES file +catch {exec rm ${imagedir}/bug27447_link.igs} +WriteIges D ${imagedir}/bug27447_link.igs + +# Processing of IGES file +set is_bug27447_fixed "FALSE" +set file_27447 [open ${imagedir}/bug27447_link.igs RDONLY] +while {[eof $file_27447] == 0} { + set file_27447_line [string trim [gets $file_27447]] + if {[string first "Very long link name" $file_27447_line] != -1} { + set is_bug27447_fixed "TRUE" + } +} +close $file_27447 + +# Results validation +if {[string compare $is_bug27447_fixed "FALSE"] == 0} { + puts "ERROR: OCC27447 is reproduced. Long labels in IGES files are not supported." +}