DiscussionsIssue archiveVisualization and 3D Viewer

Forum archive

Visualization and 3D Viewer

Technical discussions preserved from the public OCCT community forum.

Topics
627
Replies
1,764
Files
507

Discussions

Page 7 of 11

Showing 60 discussions, ordered by the latest archived activity.

Graphic3d_CubeMapPacked Error

TCollection_AsciiString filename = QString("C:/Users/pathToPicture/sky.png").toStdString().c_str(); Graphic3d_CubeMapPacked cubeMap(filename); m_view->SetBackgroundCubeMap(&cubeMap); Produces following error: TKOpenGl | Type: Error | ID: 0 | Severity: High | Message: Unable to get the first side of

4 replies2 files

A proper way to make animation of AIS_Shape on scene

Hello. What is the best way to use animation of objects on scene (preferably, AIS_Shape entries)? I have looked at the mfc-related example, but it was not clear for me. Now I'd like to start from simpler example - move a cyllinder with certain speed to a point and the stop. There are two ways: 1. Us

28 replies

How to get TopoDS_Shape through mouse click

Hi Bros, I'm new in OCCT, I learn the AIS with the code of Kirill Gavrilov https://unlimited3d.wordpress.com/2021/11/16/ais-object-computing-presen... , I try to get the imformation of the face I select, Maybe location an orient of Cylindrical surface. I thought I can get it with the help of BRepAda

0 replies1 file

Graphic3d_Camera::Projection_Perspective make mouse point offset

Hi I move a AIS obejct by mouse in my program ,when set "myV3dView->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Perspective)" when id move mouse , the AIS obejct can not follow the mouse , if i not set "myV3dView->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Perspective)" ,i

0 replies

The Triedron changes position

Hi, I use OCC to display a coordinate system. When I zoom the window, the coordinate system shifts! This problem also exists in the OCC sample androidqt Who can help me? The code below: V3d_View::TriedronDisplay(Aspect_TOTP_LEFT_LOWER,Quantity_NOC_RED, 0.1, V3d_ZBUFFER);

6 replies1 file

conflict of rotated solid with intersection calculation

Hi, after assembling a work setup I started to workout face selection. I rotate all elements to desired position and on selecting a face, I calculate a plane from the face and calculate intersection with the blue transparent box. Blue box is a Handle(AIS_Shape) member variable and rotation is perfor

4 replies7 files

AIS_TextLabel position

Hello all I have trouble to positioning an AIS_TextLabel when I attache it to a parent. The Label shows on the given Position (0,0,3000) but when I move parent the text is moving not the same distance (~ 2.5 times more) but in the correct direction m_aisTextLabel = new AIS_TextLabel(); m_aisMain->Ad

1 reply

Understanding problem with TopoDS_Shape

Hi, I finally got the Euler angles thing figured out. This works quite well: I load a step file (SC_Setup00.jpg), which results in a misoriented model. I then rotate that to the desired position (SC_Setup01.jpg) and press "Set" (SC_Setup02.jpg). gp_Trsf t = model->Transformation(); const TopoDS_Shap

1 reply5 files

Relationship between Layer, View, Viewer, and Context

I have a single context and single viewer, but create multilple views so the scene can be viewed from different directions. For each view I create a Visual3d_Layer so that I can add text and linework. I'd like to add different text to each view. Unfortunately, all views appear to draw the same overl

2 replies

Can't change location of shape correctly

TopoDS_Shape shape = myAisShape->Shape(); myContext()->Remove(myAisShape, true); gp_Trsf trsf = myAisShape->Transformation(); Standard_Real x = ui->xSpinBox->value(); Standard_Real y = ui->ySpinBox->value(); Standard_Real z = ui->zSpinBox->value(); trsf.SetTranslationPart(gp_Vec(x,y,z)); BRepBuilder

2 replies

use AIS_Animation for rotate animation?

I use AIS_Animation for rotate animation,but it interpolation tool is gp_QuaternionNLerp,thre result is not my want,What should i do use AIS_Animation for right rotate animation?

1 reply

Fit/Zoom to a defined rectangle (rubber band)

Hi guys, I would like the V3d_View to zoom or fit to a defined rectangle (the rubber band), there a V3d_View->FitAll method supplied with theMinXv, theMinYv, theMaxXv, theMaxYv but it doesn't look like what I'm looking for. Please help. Thank you.

2 replies

AIS_ViewCube hover color

Hello all! please, could someone tell me how to change the color of the faces when I hover over it with the mouse. Luxury problem, but drives me nuts Thank you! m_viewCube = new AIS_ViewCube(); m_viewCube->SetSize (60.0); m_viewCube->SetColor (Quantity_NOC_LIGHTGOLDENROD); m_viewCube->SetInnerColor(

1 reply

Need help on rotation

Hi, I'm working on a little viewer and actually I have a problem understanding rotation. Out of curiosity I tried V3D_View::Rotate with the angles from spinboxes, but only rotation around X-axis works as expected. Rotation around Y- or Z-axis don't rotate around the axis, but around a centerline bet

4 replies3 files

Problems processing selection

Hi, I added selection processing to mouse click handler like this: void OcctQtViewer::mousePressEvent(QMouseEvent* e) { QOpenGLWidget::mousePressEvent(e); const Graphic3d_Vec2i aPnt(e->pos().x(), e->pos().y()); const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(e->modifiers()); if (!myView.IsNul

2 replies

Activate selection type not working

I am trying to activate a single selection type (TopAbs_FACE) on a group of AIS_ColoredShape's and disable all selection on other AIS_ColoredShape's. I am currently able to get the desired behavior by in the code below. Handle(AIS_InteractiveContext) ic; Handle(AIS_ColoredShape) shapeToActivate; Han

1 reply

Color Mapping Assembly Shapes

Hello, I'm working on a viewer using OpenCASCADE. The user uses the STEP format to load geometric shapes. Actually, everything is working fine so far. First of all, these geometric shapes go into a kind of simulation and draw conclusions according to calculation. I have thousands of rows of data out

2 replies3 files

V3d_Viewer HighDPI Scale issue on mouse selection

Hello, I was developing occt on top of Qt and when I open the application on scaled windows (native regulation 4k scaled to %150). I'm unable to click on the shape/mesh because of the scale, I had move mouse away from the shape/mesh able to "highlight" so I can click on it. Basically mouse position

1 reply

MeshVS Transparency Setting

Hello, I load my STL file via MeshVS, I can give color configs but I can't set transparency even If set "aMesh->SetTransparency(0.9);" value it still doesn't effect it.

2 replies

OpenCASCADE 7.1.0 AIS_TexturedShape has no texture

Hello, I want to display a textured shape. The program doesn't crash, but the shapes are plain. I can change color, material, transparency, etc., but no textures. I found in other forum posts that I have to call SetSurfaceDetail(V3d_TEX_ALL) from my V3d_Viewer. However, this was deleted in OpenCASCA

10 replies6 files

PrsMgr_ListOfPresentableObjects get Shape() from child

Hello all, how to get the shape of a child of a AIS_Shape? Thanks! m_aisDisplay->addChild(...); PrsMgr_ListOfPresentableObjects children = m_aisDisplay->Children(); for(const Handle(PrsMgr_PresentableObject)& value : children) { { AIS_Shape s = static_cast<Handle(AIS_Shape)>(value); // doesn't work.

1 reply

Raytracing BRep API

Hello, I want to know some fundamentals of how OCCT raytrace the BRep. For exmaple, raytracing triangle meshes is well understood and the most basic operation is ray-triangle intersect. How does OCCT handles ray-surface intersection with primitives like NURBS? Can someone point out where to look at?

2 replies1 file

Change selection mode and click the background will raising error

Hello, I try to develop a simple CAM software in C# winform. Now when I change the selection mode to Solid or Face ...etc, and if I click nothing in the cad model(position like the image file attached, and I have already written if selected shape is null condition but it doesn't work), it will raise

2 replies1 file

Arrow drawing

Hello, I want to draw arrows to represent the direction of surface normal vector. And I took the https://dev.opencascade.org/content/arrow-representation and https://dev.opencascade.org/doc/occt-7.5.0/refman/html/class_prs3d___arrow.html as reference (my OCCT version is 7.5.0). However, I don't know

1 reply

Displaying Poly_Triangulations

Dear, I'm trying to display a Poly_Triangulation (extracted from an STL-file using the RWSTL-module). I've currently found 2 ways that work but for each solution I'm facing a (different) problem. Note that I'm using the pythonocc wrapper, but the steps should be the same. METHOD 1 Using AIS_Triangul

4 replies2 files

Usage problem of anti-aliasing in WebAssembly

Hi. I'm trying to add anti-aliasing to my WebAssembly application as follow, but it doesn't seems to work. Graphic3d_RenderingParams& aParams = view->ChangeRenderingParams(); aParams.IsAntialiasingEnabled = Standard_True; // I tried this as well not really sure how to use it aParams.NbMsaaSamples =

5 replies1 file

OcctQtViewer Deletion Crash

Hello, I encounter a crash when i try to delete OcctQtViewer. When OcctQtViewer destructor works, program crashes. I do not want OcctQtViewer live for the life cycle of the application. I need to open/close the page frequently. The same logic at https://github.com/gkv311/occt-samples-qopenglwidget a

4 replies4 files

AIS_PointCloud doesnt show any points

Hello Guys, I decided to use AIS_PointCloud to draw set of points. My code is below: BRepMesh_IncrementalMesh(shape, 0.1); std::vector<gp_Pnt> vecPoints; GA_COMMON::CollectPoints(shape, vecPoints); Handle(Graphic3d_ArrayOfPoints) thePoints = new Graphic3d_ArrayOfPoints(vecPoints.size(), true, false)

3 replies

OcctQtViewer Destructor Crash / Default FBO Wrapper Creation Failed Error

Hello, We realized that, we encounter the crash when we try to delete OcctQtViewer. When OcctQtViewer destructor works, program crashes. We do not want OcctQtViewer live for the life cycle of the application. We need to open/close the page frequently. We apply the same logic at https://github.com/gk

0 replies1 file

Partial update of the content of an AIS_InteractiveContext

Hello, is there a way to update just some AIS_InteractiveObject within an AIS_InteractiveContext when the ->UpdateCurrentViewer() method is called? In my application upon certain circumstances, I need to call repetitively this method in order to update something that changes its aspect very often (u

3 replies2 files

Setting Colors from a STEP model not always working

Hello, We have an application that models a printed circuit board (PCB) using electronic components imported from STEP models and primitives to define the other objects on the board. We import each STEP model and add it to the board model and then set the color of the added shape(s) in the board mod

0 replies

Determining a location on a 3D model from mouse coordinates

Hello, I've looked through this forum for how to convert mouse coordinates in a 3D window to an actual location on a 3D model. Using our old viewer which uses Immediate mode OpenGL, it's quite easy. See Below: How is this done in Open Cascade? I've tried the V3d_View Convert method and it works, but

2 replies

OpenCASCADE Inspector customizing

I wanna customizing a "Inspector". So, I do some steps according to Inspector guide like picture. But, some errors are occurred. there is no "inspector" folder that has .hpp and .cpp like "TInspector_Communicator.hxx" and "TInspectorAPI_PluginParameters.hxx"~~. But, there are some folders like "TIns

1 reply1 file

Error on OpenGl_GlFunctions.hxx with glext.h

Hello, With the current use of glext.h, we are getting a build error in our project. When we manually change the name of glext.h to OpenGl_glext.h and then include the use on line 96 of OpenGl_GlFunctions.hxx with this new name and compile the source code from the beginning, we do not encounter any

2 replies

Understanding basic example

I am trying to understand the following example: Handle(V3d_Viewer) theViewer; Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext (theViewer); BRepPrimAPI_MakeWedge aWedgeMaker (theWedgeDX, theWedgeDY, theWedgeDZ, theWedgeLtx); TopoDS_Solid aShape = aWedgeMaker.Solid(); Handle(AIS_

4 replies

Viewport "foggy" backround

Hello, We have been toying with setBgGradientColors() to set different background colours and gradients. And this works ok, but it would be cool if we could add a more "fancy" background such as a fog-like background as in Blender. Is there any way to implement a foggy background with an OpenGL shad

3 replies2 files

Graphic3d_TOSM_PBR No working the same between 7.5.0 to 7.6.0

Hello, I can't toggle anymore between Graphic3d_TOSM_PBR and Graphic3d_TOSM_FRAGMENT by simply changing value Graphic3d_RenderingMode::ShadingModel and updating the view 3d (V3d_View::Redraw() ), has something change between 7.5.0 and 7.6.0 in that regards? In 7.6.0, if I start my application with G

9 replies1 file

PrsDim_Dimension

Hello, how to get dimensions visible? TopoDS_Edge edge = TopoDS::Edge(shapes.at(0)); gp_Pln thePlane; Handle(PrsDim_LengthDimension) lengthDimension = new PrsDim_LengthDimension(edge, thePlane); lengthDimension->SetColor(Quantity_NOC_ANTIQUEWHITE3); lengthDimension->SetDisplayUnits("units"); OccView

1 reply

Crash on Linux when initializing display

I'm getting a crash when creating a new Xw_Window object. We're using a wxWidgets panel to display but I get a crash in the Aspect Window creation section below. Is there something I'm doing wrong? Works fine on Windows. Thanks very much. /* ----------------------------------------------------------

2 replies

OpenGl Context in Multithreading

I'm trying to make a separate thread which has to work with visualization via AIS_InteractiveContext. It raises a problem of one OpenGl context for two threads. It's not obvious for me how to handle several OpenGl contexts in terms of OpenCascade (maybe even one and somehow shared). Could you please

8 replies1 file

How to change the AIS_SHAPE param?

Hello, for example,I crated an edge,I want to change the position of an endpoint,but I think more cpu will used if I delete it and the create new one,Is there a better way? How about a more complicated shape?

2 replies

Reselect sub shape of an AIS_Shape

Hello, what is the best way to select a sub-shape (TopoDS_Shape) of an AIS_Shape? I want to do the reserve of what AIS_InteractiveContext::DetectedShape() gave me, starting from a state where nothing is selected in AIS_InteractiveContext and add a sub-selection using the API. Best regards, François.

2 replies

Selecting planes in AIS_Trihedron

I would like to have a possibility of selecting planes in AIS_Trihedron object, but I couldn't find any information about it (except one which is now deprecated - I'm using OpenCascade 7.5.0). Could you please answer if there any chance of having selectable planes in AIS_Trihedron?

2 replies

Some Error In User Opengl Draw Object

Hello, When I use the opengl primitives in opencascade based application, according to ViewerTest_OpenGlCommands.cxx file, Below is a snippet of the code. He did draw what I wanted, but it was blocked by two triangle primitives , and I could see the following elements from the gap, such as the coord

3 replies1 file

How to set offset of AIS_InteractiveObject?

Hi, I created a AIS_Point and show its name using AIS_TextLabel, but they're too close. I want to move the label a little bit to the upper right,what should I do?

2 replies1 file

problems with update/refresh

Hi, I use the occwindow from transparency demo and until now everything worked fine. Now I started to move elements programmatically and that does not work. Well, the movement applied to the shapes works, but nothing happens on screen. I tried update(), updateView() and even direct call to paintGL()

4 replies

Debug clipping plane not working on some STEP files

Hi, I am using the clipping plane feature in OCC 7.5.2, and the following code (I'm using python bindings from pyOCCT ) works as expected on nearly all STEP files I've loaded. shape_viewer = ShapeViewerQt(width=512, height=320) shape_viewer.display_shape(foo, rgb=Quantity_Color(Quantity_NOC_BLUE)) s

5 replies1 file

How can I contact the AIS_InteractiveObject and qwidget?

Hello everyone, I created some shapes in the view. Each shape has a number. I want to get the serial number of the shape when I put the mouse on it, but I don't know how to connect the number with the shape. I tried to save AIS_InteractiveObject pointer when I created the shape, and use Context->Sel

2 replies

OCCT 7.4.0 application get error in win10 with OpenGL 4.6

Hello My platform is MS win7 64-bt, VS2015 VC14, .Net v4.5.2 and my application can work. But it gets an error when it's run in win10 system and the error message is below TKOpenGL | Type: Error | ID: 0 | Serverity: High | Message: OpenGL context reports version 4.6 but does not export required func

10 replies

occ disables transparency of Qt widgets

Hi, I want to create some OSD like display. For testing purpose I extended a Qt sample (hellogl2) which worked ootb. Trying to achieve the same with occ failed. Occ turned Qt transparent background into fully opaque. I tried to add Qt::WA_NativeWindow but that did not change anything. Is it possible

5 replies2 files

Full Window Issue With Using QML + OpenCASCADE

Hello there. I'm trying to make a simple simulation viewer with a qml project. I have OpenCASCADE viewer working in full frame. I want to add menu bar, tool bar stuff. I have reviewed the AndroidQt application. However, I think the viewer class is out of date. Is there anything you can suggest? The

1 reply

Is there a way to disable AIS_ViewController?

Hi, I use AIS_ViewController in a Qt-Widget with stacked layout (like GeomWidget), but all other pages are Qt only stuff. On switching through all pages, when a Qt-page is activated the second time, event-handling for Qt is not working any more (see attached image). Looks like occ is "steeling" some

6 replies1 file

ClippingPlane Hatching not working (SetCappingHatch)

Hello Friends, I want to use clipping planes with hatching. Capping works but hatching style is not applied, only solid capping is rendered no matter what I set to SetCappingHatch. Code: Handle(Graphic3d_ClipPlane) plane = new Graphic3d_ClipPlane(); plane->SetCapping(true); plane->SetCappingHatchOn(

13 replies7 files

AIS_Shape Dynamic Hilight line width does not work

Hi, I would like to change the attributes of Edge presentation in DynamicHilightAttributes. But it does not work. Handle(AIS_InteractiveContext) ctx = ...; TopoDS_Shape shape = MakeBox(20, 20, 20); Handle(AIS_Shape) prs = new AIS_Shape(shape); prs->SetDynamicHilightAttributes(new Prs3d_Drawer()); pr

3 replies

unwanted clipping

hello, the problem description: attached image shows the situation, when animated moving of object along the x-axis (po_Context->SetLocation (poAISShape, o_Trafo);) leads to unwanted effect of clipping. V3d_View object contains no clipping planes. when the scene is redrawn (it is enough to move the

5 replies1 file

occt render to texture without window

Hi, I want to use occt + glfw + imgui to program a app. Here is how I init occt and render void OCCTRenderer::initViewer(GLFWwindow* win) { if (m_Display.IsNull()) m_Display = new Aspect_DisplayConnection; Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (m_Display, false); Han

4 replies1 file