Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export step problem #66

Open
happydpc opened this issue Jan 7, 2022 · 2 comments
Open

Export step problem #66

happydpc opened this issue Jan 7, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@happydpc
Copy link

happydpc commented Jan 7, 2022

Export step fail

After ruling the surface, the export step file failed at Serialize the Edge with cur3d is "Path". Because path not impl IExportStep interface.

Here's the testcase file.
test_ruled.cdb.json.zip

image

@dsn27 dsn27 added the bug Something isn't working label Oct 26, 2022
@dsn27
Copy link
Collaborator

dsn27 commented Oct 26, 2022

This error happens because CADability.GeoObject.Path does not implement IExportStep.
Thus the cast (curve3d as IExportStep) will return null.

Either implement the interface or use a safe cast.

CADability/CADability/Edge.cs

Lines 3567 to 3575 in 2418191

if (!export.EdgeToDefInd.TryGetValue(this, out int ec))
{
// #64=EDGE_CURVE('',#44,#58,#63,.F.) ;
int nv1 = (Vertex1 as IExportStep).Export(export, false);
int nv2 = (Vertex2 as IExportStep).Export(export, false);
int cn = (curve3d as IExportStep).Export(export, false);
ec = export.WriteDefinition("EDGE_CURVE('',#" + nv1.ToString() + ",#" + nv2.ToString() + ",#" + cn.ToString() + ",.T.)");
export.EdgeToDefInd[this] = ec;
}

System.NullReferenceException
HResult=0x80004003
Message= Object reference not set to an instance of an object
Source=CADability
StackTrace:
at CADability.Edge.CADability.IExportStep.Export(ExportStep export, Boolean topLevel) in C:\Development\Repos\SOFAgh\CADability\CADability\Edge.cs:line 3572

@x68507
Copy link

x68507 commented Apr 25, 2023

It looks like my file containing only a circular surface might have the same issue.

CADability can import correctly but it cannot export the surface as a STEP file. The export fails and programs like NIST STEP File Analyzer and Viewer cannot even parse the exported STEP file. It looks like the EDGE_LOOP has no reference entity and the B_SPLINE_CURVE_WITH_KNOTS & corresponding CARTESIAN_POINT are never written to the file.

fma_02-good.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants