Measure bodies distance
Measure bodies distance
(OP)
I need a macro to do the following. I have two bodies located in 2 different parts, that I need to measure the distance between both.
How can I do it? I only have four days examples for parts.
I'm doing in vb.net, but you can help me in the other languages.
How can I do it? I only have four days examples for parts.
I'm doing in vb.net, but you can help me in the other languages.
Tiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...





RE: Measure bodies distance
CODE --> CATVBA
Sub CATMain() Dim partDocument1 As PartDocument Set partDocument1 = CATIA.ActiveDocument Dim part1 As Part Set part1 = partDocument1.Part 'Two bodies are already selected Set selection1 = partDocument1.Selection Dim a As Body Dim b As Body Set a = selection1.Item(1).Value Set b = selection1.Item(2).Value Dim reference1 As Reference Set reference1 = part1.CreateReferenceFromObject(a) Dim reference2 As Reference Set reference2 = part1.CreateReferenceFromObject(b) 'get the SPAworkbench Dim TheSPAWorkbench As Workbench Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench") Dim TheMeasurable As Measurable Set TheMeasurable = TheSPAWorkbench.GetMeasurable(reference1) Dim MinimumDistance As Double MinimumDistance = TheMeasurable.GetMinimumDistance(reference2) End SubTiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...
RE: Measure bodies distance
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Measure bodies distance
But i don't have the need to export it. It's something that I need during a macro execution, Depending in the value of the measure it does some actions.
Tiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...
RE: Measure bodies distance
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU