Vectorization and Rendering Questions

  1. FAQ
  2. »
  3. Vectorization & Font Handling
  4. »
  5. Vectorization and Rendering Questions

Does objtoolkit support textures?

Yes, OBJToolkit does support materials with textures.

But don't forget that materials definitions aren't a part of .obj file and stored in .mtl file. Obj file has references to those .mtl file(s) (lines with mtllib token, as mtllib filename.mtl) to take materials definitions from. Materials definitions in .mtl files refer jpg/bmp/... files, so if you have images of .obj file but there isn't any corresponding .mtl file, materials (and textures) won't be imported.

How to turn off the default light in the environment? Which function do I need to call to implement it? Can you tell me how can I turn off the default light?

There is no any lighting in 2dWireframe, 3dWireframe and HiddenLine rendering modes. Lighting exists only in Shaded rendering modes.

Following Database Variables can be used to control behavior of lights inside drawing viewports:
https://docs.opendesign.com/td/DEFAULTLIGHTING.html
https://docs.opendesign.com/td/DEFAULTLIGHTINGTYPE.html

You must take into account that if you will disable Default Lighting, you must provide your own light sources into Database, elsewhere default lights will be enabled even if you disabled them. This behavior is logically correct, because if your graphics scene haven't at least one light source - your Shaded geometry will not be highlighted, so all graphics inside scene will be black and I don't think that anybody expects such result (very similar result will be shown in case if you switch onto HiddenLine rendering mode).

How to adjust the brightness and direction of the default light source?

You can add distant light into your drawing, after that you can disable default lighting since your graphics scene will contain non-default light.

OdDbLightPtr pLight = OdDbLight::createObject();
pLight->setDatabaseDefaults(pDb);
pLight->setLightType(OdGiDrawable::kDistantLight);
pLight->setLightDirection(OdGeVector3d::kZAxis);
OdDbBlockTableRecord::cast(pDb->getActiveLayoutBTRId().openObject(OdDb::kForWrite))->appendOdDbEntity(pLight);

In our application we want to have two or more model viewports on separate windows. How to implement this?

To draw in set of windows you need create separate OdGsDevice for each window. You can use same OdGiContextForDbDatabase for each device. OdEdBaseIO and OdExEditorObject is realated for editing capabilities and doesn't related to device. Trackers attached onto OdGsView, so there is no problem to use them in separate windows/devices.

How to get text color vectorizing DWG?

Color is stored in OdGiSubEntityTraits ( method colour() ). Entities set property here start drawing.

Is there an easy way to render proxy graphics metafile data to an OdGiWorldDraw context?

The easiest way is to call the worldDraw() method of the proxy entity.

Do ODA SDKs support per-face transparency for OdDbPolyFaceMesh?

ODA SDKs don't support per-face transparency for OdDbPolyFaceMesh. Transparency on an entire OdDbPolyFaceMesh entity can be set instead.

How to control the vectorizer triangulation count for shells?

You can control the vectorizer triangulation count for shells using the following code:

ModelerModulePtr pM = odrxDynamicLinker()->loadModule(OdModelerGeometryModuleName, false);
wrTriangulationParams TriangulationParams;
TriangulationParams.normalTolerance = 0.5;
TriangulationParams.PointsPerEdge = 1000;
TriangulationParams.BetweenKnots = 100;
TEST_ASSERT(eOk == pM->setTriangulationParams(TriangulationParams));

Also you can check the OdaMfcApp sample: Tools->Options->Triangulation Params.

What is the difference between exploding and vectorization?

Vectorization is a process of converting database entity representation into a set of simple geometry primitives that could be used for rendering, exporting, etc. For example, a circle entity could be converted into a set of line segments, text could be tessellated into a set of triangles, etc.

Exploding is a process of subdividing database entities into simpler database entities. For example, a custom entity with text and circle geometry could be exploded into circle and text entities, but the explosion process does not change the type of entity geometry. For example, a circle and text cannot be exploded further because they are the simplest primitives themselves.