1

enter image description here

Using a Catia V5 macro I want to get the coordinates of the points inside Repetition(Points and Planes).1. This Repetition(Points and Planes).1 is inside a geometrical set (Shown in image).

I have used selection.search to select Repetition(Points and Planes).1. But I'm not able to get the coordinates of the points.

Dim objSel As Selection

objSel.Search "'Generative Shape Design'.'Repetition (Points and Planes)',sel"

I want to export the point coordinates to a txt file after selecting the geometrical set (pntRep shown in image).

Quima
  • 894
  • 11
  • 21
harishli2020
  • 305
  • 6
  • 19

1 Answers1

2

The Repetition (Points and Planes) object is threated as a HybridBody, the same as a GeometricalSet.

So, to get the instance of Repetition all you have to do is threat him as a HybridBody, you don't need to use Selection.Search method to get it you could do as follow:

Dim HybridBodypntRep as HybridBody
dim HybridBodyInternal as HybridBody
set HybridBodypntRep = objSel.item(1).value
for i = 1 to HybridBodypntRep.HybridBodies.Count
    set HybridBodyInternal = HybridBodypntRep.HybridBodies.Item(i)
    for j = 1 to HybridBodyInternal.HybridShapes.Count
        'Here you will have access to all points and planes inside the Repetition
        dim Element as HybridShape
        set Element = HybridBodyInternal.HybridShapes.Item(j)
        'Element is probably your point, just check it
next

The Element object is the one that is probably your Point.

Note that this code will loop over all the internal Geometrical Sets inside the selected one, in the first level and look for all elements inside it.

Quima
  • 894
  • 11
  • 21
  • @AgustoQ Thank you for the answer. I had to remove HybridShapeTypeLib as I was getting error as "User defined type not defined". – harishli2020 Apr 27 '17 at 13:34
  • Just edited the answer to attend your request. I develop for Catia with VB.Net and it generaly requires namespaces to declare objects, but inside Catia VBA you don't need that. Sorry about that. – Quima Apr 27 '17 at 13:42