View Issue Details

IDProjectCategoryView StatusLast Update
0003332TechDrawBugpublic2018-10-25 23:21
Reporterwandererfan Assigned Towandererfan  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.17 
Target Version0.18Fixed in Version0.18 
Summary0003332: Drawing View Position is Wrong in CoarseView
DescriptionForum discussion
If CoarseView is true, and Perspective is false, the DrawingView is not centred around the origin and will be shifted from the expected x,y position. The amount of the shift depends on the size and scale of the view.

This appears to be an upstream bug, and a query has been posted to the OCCT forum.

Only OCCT 7.2.0 has been tested for this bug.

Working example code that does not rely on FC is attached.
TagsOCC 7.2, OCC Bug, TechDraw, upstream
FreeCAD Information

Activities

wandererfan

2018-01-27 19:27

manager  

main.cpp (2,562 bytes)   
#include <iostream>

#include "OpenCascadeAll.h"

#include <BRepLProp_CurveTool.hxx>
#include <BRepLProp_CLProps.hxx>

#include <HLRBRep.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <HLRAlgo_Projector.hxx>

#include <BRepMesh_IncrementalMesh.hxx>
#include <HLRBRep_PolyAlgo.hxx>
#include <HLRBRep_PolyHLRToShape.hxx>

void dumpShape(const TopoDS_Shape& s);

int main()
{
    std::cout << "PolyAlgo Start" << std::endl;
    gp_Pnt org(0,0,0);
    gp_Pnt ext(50,50,50);
    gp_Pnt centroid(25,25,25);
    gp_Dir z(0,0,1);
//    gp_Ax2 viewAxis(org , z);
    gp_Ax2 viewAxis(centroid , z);

    BRepPrimAPI_MakeBox mkBox(org,ext);
    TopoDS_Solid mySolid = mkBox.Solid();

    //use exact algorithm to project box
    Handle(HLRBRep_Algo) brep_hlr = NULL;
    brep_hlr = new HLRBRep_Algo();
    brep_hlr->Add(mySolid);
    HLRAlgo_Projector projector( viewAxis );
    brep_hlr->Projector(projector);

    brep_hlr->Update();
    brep_hlr->Hide();

    HLRBRep_HLRToShape hlrToShape(brep_hlr);
    TopoDS_Shape visHard    = hlrToShape.VCompound();

    std::cout << "exactAlgo Result:" << std::endl;
    dumpShape(visHard);
    std::cout << std::endl;

    //use polygon algorithm to project box
    BRepMesh_IncrementalMesh(mySolid, 0.10); //Poly Algo requires a mesh!
    Handle(HLRBRep_PolyAlgo) brep_hlrPoly = new HLRBRep_PolyAlgo();
    brep_hlrPoly->Load(mySolid);
    brep_hlrPoly->Projector(projector);
    brep_hlrPoly->Update();

    HLRBRep_PolyHLRToShape polyhlrToShape;
    polyhlrToShape.Update(brep_hlrPoly);
    visHard = polyhlrToShape.VCompound();

    std::cout << "polyAlgo Result:" << std::endl;
    dumpShape(visHard);

    std::cout << "PolyAlgo End" << std::endl;
    return 0;
}

void dumpShape(const TopoDS_Shape& s)
{
    TopExp_Explorer expl(s, TopAbs_EDGE);
    int i;
    for (i = 1 ; expl.More(); expl.Next(),i++) {
        const TopoDS_Edge& e = TopoDS::Edge(expl.Current());
        BRepAdaptor_Curve adapt(e);
        double start = BRepLProp_CurveTool::FirstParameter(adapt);
        double end = BRepLProp_CurveTool::LastParameter(adapt);
        BRepLProp_CLProps propStart(adapt,start,0,Precision::Confusion());
        const gp_Pnt& vStart = propStart.Value();
        BRepLProp_CLProps propEnd(adapt,end,0,Precision::Confusion());
        const gp_Pnt& vEnd = propEnd.Value();
        std::cout << "edge: " << i << " start: (" << vStart.X() << "," << vStart.Y() << "," << vStart.Z() << ") end: (" <<
                  vEnd.X() << "," << vEnd.Y() << "," << vEnd.Z() << ")" << std::endl;
    }
}
main.cpp (2,562 bytes)   
OpenCascadeAll.h (9,193 bytes)   
/***************************************************************************
 *   Copyright (c) 2007 Werner Mayer <wmayer@users.sourceforge.net>        *
 *                                                                         *
 *   This file is part of the FreeCAD CAx development system.              *
 *                                                                         *
 *   This library is free software; you can redistribute it and/or         *
 *   modify it under the terms of the GNU Library General Public           *
 *   License as published by the Free Software Foundation; either          *
 *   version 2 of the License, or (at your option) any later version.      *
 *                                                                         *
 *   This library  is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU Library General Public License for more details.                  *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this library; see the file COPYING.LIB. If not,    *
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
 *   Suite 330, Boston, MA  02111-1307, USA                                *
 *                                                                         *
 ***************************************************************************/


#ifndef __OpenCascadeAll__
#define __OpenCascadeAll__

// OpenCASCADE
#include <Standard_AbortiveTransaction.hxx>
#include <Standard_Address.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Byte.hxx>
#include <Standard_Character.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_CString.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DefineHandle.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_DimensionMismatch.hxx>
#include <Standard_DivideByZero.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_ExtCharacter.hxx>
#include <Standard_ExtString.hxx>
#include <Standard_Failure.hxx>
#include <Standard_GUID.hxx>
#include <Standard_ImmutableObject.hxx>
#include <Standard_Integer.hxx>
#include <Standard_IStream.hxx>
#include <Standard_LicenseError.hxx>
#include <Standard_LicenseNotFound.hxx>
#include <Standard_Macro.hxx>
#include <Standard_math.hxx>
#include <Standard_MultiplyDefined.hxx>
#include <Standard_NegativeValue.hxx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_NullValue.hxx>
#include <Standard_NumericError.hxx>
#include <Standard_OStream.hxx>
#include <Standard_OutOfMemory.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Overflow.hxx>
#include <Standard_Persistent.hxx>
#include <Standard_PrimitiveTypes.hxx>
#include <Standard_ProgramError.hxx>
#include <Standard_RangeError.hxx>
#include <Standard_Real.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_SStream.hxx>
#include <Standard_Stream.hxx>
#include <Standard_TooManyUsers.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Standard_TypeDef.hxx>
#include <Standard_TypeMismatch.hxx>
#include <Standard_Underflow.hxx>
#include <Standard_UUID.hxx>
#include <Standard_Version.hxx>

#include <TCollection_ExtendedString.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_SequenceOfExtendedString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <TColgp_HArray2OfPnt.hxx>

#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Iterator.hxx>

#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>

#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>

#include <BRep_Builder.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <BRepBuilderAPI.hxx>
#include <BRepBuilderAPI_GTransform.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <BRepOffsetAPI_MakeThickSolid.hxx>
#include <BRepBuilderAPI_NurbsConvert.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeRevol.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepPrimAPI_MakeTorus.hxx>
#include <BRepMesh.hxx>
#include <BRepMesh_Edge.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRepMesh_Triangle.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools_ShapeSet.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepCheck_Result.hxx>
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
#include <Poly_Triangulation.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Polygon3D.hxx>
#include <ShapeAnalysis.hxx>

#include <GCE2d_MakeSegment.hxx>
#include <GCPnts_TangentialDeflection.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeArcOfEllipse.hxx>
#include <GC_MakeArcOfParabola.hxx>
#include <GC_MakeArcOfHyperbola.hxx>
#include <GC_MakeCircle.hxx>
#include <GC_MakeConicalSurface.hxx>
#include <GC_MakeCylindricalSurface.hxx>
#include <GC_MakeEllipse.hxx>
#include <GC_MakeHyperbola.hxx>
#include <GC_MakeLine.hxx>
#include <GC_MakePlane.hxx>
#include <GC_MakeSegment.hxx>
#include <GCPnts_UniformDeflection.hxx>

#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dAPI_InterCurveCurve.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Line.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Plane.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <GeomAPI.hxx>
#include <GeomAPI_PointsToBSplineSurface.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomLProp_SLProps.hxx>
#include <GeomTools_Curve2dSet.hxx>

#include <gp_Ax2d.hxx>
#include <gp_Circ.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Cone.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Elips.hxx>
#include <gp_GTrsf.hxx>
#include <gp_Hypr.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Lin.hxx>
#include <gp_Parab.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pln.hxx>
#include <gp_Sphere.hxx>
#include <gp_Torus.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>

#include <MMgt_TShared.hxx>
#include <Precision.hxx>
#include <UnitsAPI.hxx>
#include <Quantity_Factor.hxx>
#include <Quantity_Length.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Quantity_PhysicalQuantity.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Quantity_TypeOfColor.hxx>

// Import
#include <STEPControl_Writer.hxx>
#include <STEPControl_Reader.hxx>
#include <StepData_StepModel.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx>
#include <IGESControl_Reader.hxx>
#include <StlAPI_Writer.hxx>
#include <Interface_Static.hxx>


#endif // __OpenCascadeAll__

OpenCascadeAll.h (9,193 bytes)   
PolyAlgo.pro (645 bytes)

wmayer

2018-10-25 23:21

administrator   ~0012093

https://github.com/FreeCAD/FreeCAD/commit/b2135da44772009f7f9699ded29db292f41420ab

Issue History

Date Modified Username Field Change
2018-01-27 19:27 wandererfan New Issue
2018-01-27 19:27 wandererfan Status new => assigned
2018-01-27 19:27 wandererfan Assigned To => wandererfan
2018-01-27 19:27 wandererfan File Added: main.cpp
2018-01-27 19:27 wandererfan File Added: OpenCascadeAll.h
2018-01-27 19:27 wandererfan File Added: PolyAlgo.pro
2018-01-27 19:27 wandererfan Tag Attached: OCC 7.2
2018-01-27 19:27 wandererfan Tag Attached: OCC Bug
2018-01-27 19:27 wandererfan Tag Attached: TechDraw
2018-01-27 19:27 wandererfan Tag Attached: upstream
2018-10-25 23:21 wmayer Status assigned => closed
2018-10-25 23:21 wmayer Resolution open => fixed
2018-10-25 23:21 wmayer Fixed in Version => 0.18
2018-10-25 23:21 wmayer Note Added: 0012093