Tue, 09/17/2013 - 18:54
I was wondering if it is possible to annotate 2D entities like faces, edges or vertices with OCC? One option would be to use STEP AP203 Ed2 FT&D or GD&A style annotations.
What I would like to do is to manually add annotations as unique labels to certain entities of a 3D part and to use these annotations at a later point to adress the specific entities e.g. for automated modeling operations. So, the user should be able to annotate a part and based on these annotations my system (using OCC) can then perform further steps without user interaction. I hope I made myself clear.
As far as I see it OCC does not support Step GD&A annotations. Am I right? If so, does anyone have an idea how such annotations could be done?
Tue, 09/17/2013 - 19:05
Oh, and just to be clear: I just want some textual annotations, no real tolerance annotations needed.
Wed, 09/18/2013 - 14:38
Dear Thomas, OCCT provides a way to associate additional data with shapes through OCAF in general, and in particular XDE component (please, see its user's guide) provides a way to define assemblies and associate names, colors, and other data to shapes. These data can be exported to / imported from STEP. There is also minimal support of GD&T (dimensional tolerances, not annotations), but this has not yet been documented in the user's guide.
Wed, 09/18/2013 - 16:39
some time ago I had to implement GD&T visualization using OCCT (GD&T / FT&A - whatever you call them - come from an external source/file using a 3rd party product). The solution I ended up with was to use the XDE assembly structure for the geometrical data. The annotations were stored separately using OCAF. Unfortunately, I had to store the shapes the annotations refer to separately (i.e. redundantly). There were two reasons for that:
1. It is possible to attach data to individual geometrical features of TopoDS_Shapes in XDE (like colors), I guess, but this is not well documented and I could not find any samples. So it was necessary to dig through the OCCT code, which isn't that easy.
2. The current implementation of XDE has some problems: visualization of 'free shapes' get recomputed very often so it was of advantage to store the annotated faces/edges separately in order to be able to manage (show, highlight etc.) them without having to cope with the recomputation of the visualization.
Hope this helps
Wed, 09/18/2013 - 17:21
Thanks to both of you for your replies!
So it seems possible but probably requires some work(around). I found the documentation for Step and XDE (https://bitbucket.org/sboz/wendel/src/df14a63bb6a2c421cba54f3183d85a1765...) and will read through it. I am especially interested in what data can be stored using XDE. I will definitely need assemblies and associate names plus textual annotations of 2D entities.
@Pawel: In what form did you store the separately stored entities (faces/edges incl. annotations) and how did you merge it with the geometrical data? I do not need an exact description, just a pointer in the right direction.
Agian, thanks for all further replies!
Wed, 09/18/2013 - 17:46
my structure looks basically like this:
Let's say I have an GD&T label in my OCAF structure. Each label under that one is an annotation. Each annotation has some attributes (text, identifiers of the referenced geometries etc.) and maybe sub-labels (depending on the annotation type).
Then there is another label storing all the referenced TopoDS_Shapes (as TNaming_NamedShape attributes, copied from the original shape, assembly etc.) created when importing the model/assembly. The tag number of each label is equal to the identifier this shapes is referenced by.
In my case the shapes do not change at all after the import so I don't have any inconsistencies. But the above approach might not be the best one if you intend to edit your annotations and/or shapes.
Fri, 02/07/2020 - 12:43
I am trying to display annotation at sharp connected face edge. I would like to display image annotation I have attached the annotations.png
Is it possible to have some special characters in image format to imbed in OCC annotation. Or is there any we can just mention the image path to show the special annotations.
Fri, 02/07/2020 - 16:14
What do you call here by "OCC annotation"?
If you are talking just about 3D Viewer in general (like AIS_Point), then your kind of icons can be displayed as point sprites (Graphic3d_AspectMarker3d constructor from Image_PixMap).
Mon, 02/10/2020 - 09:42
Thanks for the reply. OCC annotation means I am trying to give special symbols/image/icons as annotations to the connecting edge of two faces. I can give "text annotation" by using Graphic3d_AspectText3d but it does not support special symbols in text format. So I was looking if its possible to display icons/images as a annotation. I hope this clears my requirement. If you have any idea how to make it Can you please give me some example?
Thanks in advance!
Mon, 02/10/2020 - 10:41
Use marker to show a custom icon.
Text may display only symbols defined in a font - so alternatively you may choose a font and symbols in it that you expect.
As there are a lot of funny symbols in UNICODE nowadays, including emoji, there is a chance that you will find some.
Sometimes applications use special fonts for displaying non-standard symbols.
Mon, 02/10/2020 - 14:18
Thank you ! I will try with marker. I guess only thing I need to look for is "Image_PixMap" initialization with icon bitmap image with given path of icon.
Mon, 02/10/2020 - 16:00
Do you know how to use "Image_PixMap" with icon paths. I am having some icons stored at C:\ drive and want to refer that icons using "Image_PixMap".
Mon, 02/10/2020 - 18:12
Take a look onto class Image_AlienPixMap, which is subclass of Image_PixMap.
Tue, 02/11/2020 - 08:43
Thank you Kiril. I am able to load icon image.
Wed, 02/12/2020 - 16:43
One more query actually I want to change the color of icon from the image file ? Is this possible ? I have seen the Image_PixMap class there are some methods to know the pixel color but I didn't find any to set the color.
Please let me know if is there any solution to make it work.
Wed, 02/12/2020 - 17:10
Check the "Markers in 3d viewer" sample within Draw Harness to see various options.
Imported grayscale image is considered as color-less transparency levels, so that they will take a color of marker aspect.
RGB(A) images are considered as colored, so that only dynamic highiglighting presentation will be displayed with modified color
using grayscale image generated by Graphic3d_MarkerImage::GetImageAlpha() tool.
You may write your own code for processing RGB(A) images in the way you need.
Thu, 08/20/2020 - 16:47
I am using Graphic3d_AspectText3d to display text annotation. I am facing some issues when we do zoom-in and zoom-out I am not able to see annotations and the size of the annotations as well not appropriate. Please see below code snippet of display text annotation.
Please let me know if I am doing a correct thing or is there anything missing. Thanks in advance.
TextInfo as defined as below,
TextInfo textInfo = new SXTextInfo();
textInfo.Color = QuantityNameOfColor.Quantity_NOC_MAGENTA1;
textInfo.IsZoomable = false;
textInfo.Height = textInfo.Height/10.0;
textInfo.TextFontAspect = TextFontAspect.Font_FA_Bold;
textInfo.TextPath = Graphic3dTextPath.Graphic3d_TP_UP;
public void DisplayTextAnnotation(string text, double location, TextInfo textInfo)
Quantity_NameOfColor color = (Quantity_NameOfColor)textInfo.Color;
Aspect_TypeOfStyleText aspectStyle = (Aspect_TypeOfStyleText)textInfo.AspectStyle;
Graphic3d_HorizontalTextAlignment horizontalTextAlignment = (Graphic3d_HorizontalTextAlignment)textInfo.HorizontalAlignment;
Graphic3d_VerticalTextAlignment verticalTextAlignment = (Graphic3d_VerticalTextAlignment)textInfo.VerticalAlignment;
Graphic3d_TextPath textPath = (Graphic3d_TextPath)textInfo.TextPath;
Graphic3d_AspectText3d aTextAspect = new Graphic3d_AspectText3d();
Graphic3d_Group textGroup = Prs3d_Root.CurrentGroup(prsPartNamePresentation);
Graphic3d_Vertex aPoint = OCCConvertor.Graphic3d_Vertex(location);
textGroup.Text(text, aPoint, textInfo.Height, textInfo.Angle, textPath, horizontalTextAlignment, verticalTextAlignment, true);