Curve names are truncated to 8 characters on IGES import

Hi all,

I need to import a model generated by another software that can only export to IGES. Preserving the names is important. I see the expected names for surfaces and points, but for curves (IGES type 126), the names are truncated to 8 characters when importing in Rhino.

I’ve done a minimal example file to reproduce the problem. The file has only one line. It’s name appears as ‘Long lin’ in Rhino, but should be ‘Long line name’.
line_out.igs (1.2 KB)

I’m a bit limited to test it in other software, but for example ‘ABViewer’ assigns the correct name to the imported name.

Any pointers if this is a Rhino bug or if the source file is at fault would be appreciated.

Update: I see this behaviour in Rhino for mac 5.3.2 as well as in latest Rhino WIP 5.4

maybe you should mention the software you exported this line from. i tried in Rhino and C4D there it even shows up as (5_Long lin) but both have your shortened version showing up. i guess if one of each had a bug the other one should at least recognize it and since C4D was always a monster in opening all sorts of files i guess its not Rhinos fault but rather how the software stored it. but since you have this showing up in your viewer i am clueless.

in text edit you can open all sorts of files and it will be displayed here it shows in some lines the correct name but in this one as pointed out it shows up the shortened.

Thanks for looking into that. The name should be taken from the line 2 in the parameter data section (green circle) and not from the dictionary entry (red circle).

In the meantime I did a few more tests and found a way to reproduce the issue in Rhino only. If you save a non-planar curve with a long name to IGES and re-import it, it gets the truncated. If you save a planar curve to IGES and re-import it, it keeps the long name.

With that finding, I could modify the initial file by changing the 0 at the blue circle to 1 (ie. set 126,1,1,0,... to 126,1,1,1,...). After that the line gives the correct name. It turns out that this is an IGES flag to notify if the curve is nonplanar or planar. Arguably the source file has the wrong value for this flag.

Nevertheless, because the issue is reproducible in Rhino only by exporting/re-importing an non planar curve, I think this is also a Rhino bug.

b5f5e348b1c6b7b94b1c62e32a8c9a96d68b397a_1_690x247

Here, I would like to give an easy way to reproduce the issue (Rhino only). Following Rhino files contains two curves, one named Planar curve and the other one named Nonplanar curve:
Curves.3dm (3.7 MB)

When exporting to IGES, it gives following file:
Curves.igs (3.3 KB)

When opening that IGES in Rhino again, one curve is named Nonplana instead of Nonplanar curve.

When tweaking the IGES file in the text editor as described in the post above, the file opens correctly in Rhino. Here is the manually tweaked file:
CurvesTweakedInTextEditor.igs (3.3 KB)

These observations seem to indicate that there is a bug in the Rhino IGES reading code that prevents the name entity to be read for curves with the nonplanar IGES flag set.

I can work around the issue, but I thought it’s worthwhile to file in a proper bug report. Is the forum the right place for that or is there a proper bug tracker where these kind of things can be done?

The forum is the right place, yes. Sooner or later the report will get picked up - sometimes that might take some time but normally, a response comes swiftly. If you want, you can always create a bug tracker in YouTrack yourself. I can confirm the bug and created issue RH-42182 - one for @tim.

Thanks wim for checking it and adding the bug report.

This will be fixed in the next WIP. The problem (and Rhino was/is guilty of this too, see https://mcneel.myjetbrains.com/youtrack/issue/RH-38032) is there is a normal vector for a plane even when the curve is explicitly set as non planar. Rhino makes this a zero vector but according to the iges documentation it should not be there if the curve is flagged as non planar. Prior to this fix it would throw off the indexing for the curve object and it wouldn’t get the location of the properties right so it would fall back to the 8 character name like you have circled.

1 Like

Rhino makes this a zero vector but according to the iges documentation it should not be there if the curve is flagged as non planar.

I think this is wrong. IGES 5.3 spec says:

4.23 Rational B-Spline Curve Entity (Type 126)

If the curve lies entirely within a unique plane, the planar flag (PROP1) shall be set to 1; otherwise it shall be set to 0 If it is set to 1, the plane normal (Parameters 14+A+4K through 16+A+4K) shall contain a unit vector normal to the plane containing the curve. These fields shall exist but are ignored if the curve is non-planar.

Therefore I think only the Rhino IGES reader is wrong, not the writer. I would appreciate some feedback in the way the fix is going to be applied. For my original problem, I will need to adjust the IGES output of the other tool too (an in-house software). I mostly care about Rhino, but general IGES correctness is important too.

Edit: I did read the referred thread and tested on other software. The original IGES (as current release Rhino exports) is read correctly in CAD Assistant. The ‘fixed’ IGES file that reads correctly in Polyworks doesn’t have long names in CAD Assistant. I understand the need of RH-38032 to add an option to remove normal values for Polyworks compatibility. Nevertheless it might be worth reconsidering if the Rhino IGES reading should be modified to follow IGES standard. I think Rhino and Polyworks reading code is wrong. Please let me know if you think my interpretations are wrong.

Hi jcm,

I must have not been clear. The recent fix I made was only to the importer. Now it should get the properties index properly whether the unit vector is there or not. I only came across RH-38032 as I was working on it. It was sort of a complicated bug to find (both times), you wouldn’t think a vector would have any impact on a property like a name. Once I figured it out, it was familiar, so I looked through change logs for iges code. The fix in the exporter was only to add an option, off by default. I’m not sure what version our iges book is (a hard copy, probably a couple of decades old), that’s where I thought I saw that it wasn’t supposed to be there if the planar flag was false. I’m not at the office today. I’ll reread the 126 section very carefully and take note of the iges version on Tuesday. Maybe I misread it. If you have a link for the 126 specs you mentioned will you please post it here.

Tim

Looking back at my original post I can easily see how you thought I only worked on the exporter. My humble apologies.

Thanks for looking at it. I have the IGES spec from here (page 123).

Hi jcm,

Thanks for the link. I’m pretty sure that is the same reference we have. I just, wrongly, only looked at the parameter list and not the description. I suspect the developer who originally wrote the code did the same thing, at least for the importer. I also just realized that this post is in the Rhino for Mac forum. The fix I made has not been back ported to V5 for Mac (yet) and will not be in V5 for Windows. I’ll get that into V5 Mac when I return on Tuesday.

Tim

Thanks. Sounds good. Good to hear that a Rhino V5 Mac back-port is planned.

RH-42182 is fixed in the latest WIP