DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0033398

Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception on specific STEP model

CommunityOCCT:Modeling Algorithmsverified6 public notes

Search issues

Description

I have code that appears to throw error ```Unhandled exception at 0x00007FFAA0BFE468 (TKG2d.dll) in quad-remeshing-algorithm.exe: 0xC0000005: Access violation reading location 0x0000000000000000.``` along with this there should be a method on ShapeUpgrade_UnifySameDomain to check whether an operation is completed successfully.

Steps to reproduce

Step file in upload files, this is my code:
#include <iostream>
#include <fstream>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <STEPControl_Reader.hxx>
#include <STEPControl_Writer.hxx>
#include <TopoDS.hxx>

int main()
{
    const char* inputPath = "Attachment 1 (STEP)";
    const char* outputPath = "output.step";

    // Initialize the STEP reader
    STEPControl_Reader reader;
    if (reader.ReadFile(inputPath) != IFSelect_RetDone)
    {
        std::cout << "Error: cannot read file." << std::endl;
        return 1;
    }

    // Check the load status
    reader.PrintCheckLoad(true, IFSelect_ItemsByEntity);
    if (reader.TransferRoots() != reader.NbRootsForTransfer())
    {
        std::cout << "Error: roots transferred unsuccessfully." << std::endl;
        return 1;
    }

    // Get the shape from the reader
    TopoDS_Shape shape = reader.Shape();

    // Perform "unify domains" algorithm
    ShapeUpgrade_UnifySameDomain unifyDomains(shape);
    unifyDomains.Build();
    TopoDS_Shape unifiedShape = unifyDomains.Shape();

    // Write the unified shape to STEP file
    STEPControl_Writer writer;
    writer.Transfer(unifiedShape, STEPControl_AsIs);
    if (!writer.Write(outputPath))
    {
        std::cout << "Error: failed to write output file." << std::endl;
        return 1;
    }

    return 0;
}

Public activity

6 archived notes

Participants are labeled by their role within this record.

01Author
Attachment 1 (STEP) (1,421,303 bytes)   
02Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: Commenter 1
Date: Tue Aug 1 15:05:10 2023 +0100

    0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception on specific STEP model
    
    Added additional checking in static method FindCoordBounds to avoid processing null pcurves
03Commenter 1
04Commenter 3
Dear bugmaster,
please integrate:
OCCT: CR33398
PROD: no
05Commenter 4
Combination -
OCCT branch : [archived branch] - IR-2023-08-04
Products branch : [archived branch] - master
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Ubuntu2004-64:
OCCT
Total CPU difference: 18344.600000000195 / 18390.260000000217 [-0.25%]
Products
Total CPU difference: 12102.810000000003 / 12161.439999999999 [-0.48%]
Windows-64-VC142:
OCCT
Total CPU difference: 20332.1875 / 20298.859375 [+0.16%]
Products
Total CPU difference: 14548.515625 / 14604.578125 [-0.38%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
06Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]