MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0032280Community[OCCT] OCCT:Application Frameworkpublic2021-04-04 18:162021-04-09 17:29
ReporterKou Ouchi 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusresolvedResolutionopen 
PlatformWindowsOSVC++ 2015OS Version64 bit
Product Version[OCCT] 7.5.0 
Target VersionFixed in Version 
Summary0032280: Application Framework - TDocStd_Application's Open() is blocked.
DescriptionTDocStd_Application has 2 Open Methods as follows:

1)PCDM_ReaderStatus Open (const TCollection_ExtendedString& path, ...)
2)PCDM_ReaderStatus Open (Standard_IStream& theIStream Handle(TDocStd_Document)& theDoc, ...);

"1)" is ok. But "2)" is blocked. Target file is same content.


For referrence, my CMakeLists.txt is as follows:
===
cmake_minimum_required(VERSION 3.9.5)

project(xbf-stream LANGUAGES CXX)

set(OCCT_LIBS
  TKernel
  TKMath
  TKG2d
  TKG3d
  TKGeomBase
  TKBRep
  TKGeomAlgo
  TKTopAlgo
  TKShHealing
  TKMesh
  TKXmlL
  TKXml
  TKVCAF
  TKBinL
  TKPrim
  TKCDF
  TKLCAF
  TKCAF
  TKBin
  TKXSBase
  TKBO
  TKBool
  TKIGES
  TKSTEP
  TKSTEPBase
  TKSTEPAttr
  TKSTEP209
  TKService
  TKHLR
  TKV3d
  TKOpenGl
  TKXDESTEP
  TKXDEIGES
  TKXCAF
  #TKXmlXCAF
  TKBinXCAF
  TKOffset
  TKFillet
  TKMeshVS
  #TKXSDraw
)

  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")


  #	include(GenerateExportHeader)
  # Activate C++ exception handling
  IF (NOT CMAKE_CXX_FLAGS MATCHES "/EHsc")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") 
  ENDIF ()
  IF (NOT CMAKE_CXX_FLAGS MATCHES "/MP")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
  ENDIF ()
  IF (NOT CMAKE_CXX_FLAGS MATCHES "-Zm")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zm250") 
  ENDIF ()
  IF (NOT CMAKE_CXX_FLAGS MATCHES "/GL")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL")
  ENDIF ()
  IF (NOT CMAKE_CXX_FLAGS MATCHES "/Gy")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Gy")
  ENDIF ()


add_definitions(-DUNICODE -D_UNICODE -D_CRT_SECURE_NO_WARNINGS)

#
# include and lib directory
#
include_directories(
  $ENV{CSF_OCCTIncludePath}
)

link_directories(
  $ENV{CSF_OCCTLibPath}
)

FILE(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cxx)

if(WIN32)
  add_executable(${PROJECT_NAME} ${SOURCE_FILES})
endif(WIN32)


target_link_libraries(${PROJECT_NAME}
freetype
${OCCT_LIBS}
)

if(WIN32)
  target_link_libraries(${PROJECT_NAME}
    opengl32
  )
endif(WIN32)
Steps To ReproduceNot required
TagsNo tags attached.
Test case number
Attached Filescxx file icon main.cxx (4,078 bytes) 2021-04-04 18:16

- Relationships

-  Notes
(0100094)
kgv (developer)
2021-04-04 20:50

  std::ifstream filestream("test.xbf", std::ifstream::in);

Are you sure you want to open a binary (XBF) file as a text stream?
(0100108)
Kou Ouchi (reporter)
2021-04-05 17:27

Binary stream is returned normaly. I'm sure that my test code was bugged.
Thank you for reply.
(0100208)
mpv (developer)
2021-04-09 16:44

I confirm that the following change:
std::ifstream filestream("test.xbf", std::ifstream::in | std::ifstream::binary);
makes reading of stream work fine.

Also, I may notice that
app->NewDocument("BinXCAF", doc);
last two times (before document or stream open) is not needed - the "Open" creates document anyway.

And to make the "main.cxx" example working two methods "read_from_file" and "read_from_stream" must get document arguments by reference:
Handle(TDocStd_Document)& _doc
because after this method call and document is opened this variable must be updated also at the method-caller side.

However the original problem is outside of OCCT, so I will close this issue.
(0100209)
mpv (developer)
2021-04-09 16:45

Dear bugmaster, please close this issue.
(0100211)
Kou Ouchi (reporter)
2021-04-09 17:29

Hi, Thank you for your reply.

I understood your issues.

- Issue History
Date Modified Username Field Change
2021-04-04 18:16 Kou Ouchi New Issue
2021-04-04 18:16 Kou Ouchi Assigned To => mpv
2021-04-04 18:16 Kou Ouchi File Added: main.cxx
2021-04-04 20:47 kgv Summary TDocStd_Application's Open() is blocked. => Application Framework - TDocStd_Application's Open() is blocked.
2021-04-04 20:47 kgv Description Updated View Revisions
2021-04-04 20:50 kgv Note Added: 0100094
2021-04-05 17:27 Kou Ouchi Note Added: 0100108
2021-04-09 16:44 mpv Note Added: 0100208
2021-04-09 16:44 mpv Status new => resolved
2021-04-09 16:44 mpv Steps to Reproduce Updated View Revisions
2021-04-09 16:45 mpv Assigned To mpv => bugmaster
2021-04-09 16:45 mpv Note Added: 0100209
2021-04-09 17:29 Kou Ouchi Note Added: 0100211


Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker