Macro to export catia v5 points coordinates to excel

Senthil Kumar Ramanathan

Macro to export catia v5 points coordinates to excel

Hello Everyone,

I developed a macro to export catia v5 3D points coordinates  from catia to excel. The problem is this macro is exporting all the 3d points coordinates to excel but i need to export points coordinates  to excel from a specific Geometrical Set. I need expertise help....

sub catmain()

set objexcel=CreateObject("Excel.Application")

objexcel.Visible=True

Set objWorkbook= objexcel.workbooks.Add()

set objsheet1=objWorkbook.sheets.item(1)

objsheet1.name="Points_Coordinates"

dim coords(2) as variant

catia.activedocument.selection.search"CATPrtsearch.point,all"

for i=1 to catia.activedocument.selection.count

set selection=catia.activedocument.selection

set element=selection.item(i)

set point=element.value

point.getcoordinates(coords)

objsheet1.cells(i+1,1)=point.name

objsheet1.cells(i+1,2)=coords(0)

objsheet1.cells(i+1,3)=coords(1)

objsheet1.cells(i+1,4)=coords(2)

next i

end sub

 

Thanks in advance...

R Senthil Kumar.


 

Cliff Johnson, Cliff

RE: Macro to export catia v5 points coordinates to excel
(in response to Senthil Kumar Ramanathan)

catia.activedocument.selection.add(myGeoSet)

catia.activedocument.selection.search"CATPrtsearch.point,sel"

Senthil Kumar Ramanathan

RE: Macro to export catia v5 points coordinates to excel
(in response to Cliff Johnson, Cliff)

Thanks for the reply Mr.Cliff

I tried your suggestions but I am not able to export the points to excel.

I am getting error object required" in the line " catia. Active document . selection.add (mygeoset)"

Please give some more information. 

Thanks in advance

Edited By:
Senthil Kumar Ramanathan[Bharathiyar College Of Engg & Tech] @ Feb 12, 2014 - 12:40 AM (Asia/Calcutta)
Senthil Kumar Ramanathan[Bharathiyar College Of Engg & Tech] @ Feb 12, 2014 - 12:47 AM (Asia/Calcutta)

Cliff Johnson, Cliff

RE: Macro to export catia v5 points coordinates to excel
(in response to Senthil Kumar Ramanathan)

You have to pass the geometrcal set object to the Add method. mygeoset is the object variable referring to the geometrical set you want to search (which is a HybridBody object).I was assuming you already had this object.

If you need the user to select the geometrical set first, instead of using Selection.Add use the Selection.SelectElement2 method to perform an interactive selection and then run your search.

Senthil Kumar Ramanathan

RE: Macro to export catia v5 points coordinates to excel
(in response to Cliff Johnson, Cliff)

Thanks for the reply. 

I completed that macro, now I am able to export the points from a particular geo set.

Now my doubt is, in the part I have two axis systems Absolute axis and Machining axis systems. The points which are exported to excel shows coordinate values with respect to Absolute axis but I need coordinate values with respect to Machining axis system. Please give your suggestion and guide me to complete the macro.

Thanks in advance. 

 

Regards, 

R.senthil kumar

Edited By:
Senthil Kumar Ramanathan[Bharathiyar College Of Engg & Tech] @ Feb 12, 2014 - 10:14 PM (Asia/Calcutta)

Eric Neuville

RE: Macro to export catia v5 points coordinates to excel
(in response to Senthil Kumar Ramanathan)

get matrix from second axis system, then do matrix multiplication... google for more info

Dave Frank

RE: Macro to export catia v5 points coordinates to excel
(in response to Eric Neuville)

Hi folks,

Here is an oldie but goodie

CATIA points and Excel: there and back again   

http://www.coe.org/p/fo/st/topic=113&post=64316#p64316

May be helpful




Dave Frank  *    Bell Helicopter *  Grand Prairie Texas

Advanced Computer Aided Manufacturing Systems Engineer

COE Product Co-Chairman, Digital Numerical Control

 

Senthil Kumar Ramanathan

RE: Macro to export catia v5 points coordinates to excel
(in response to Dave Frank)

Thanks for the reply Eric & Dave.

hakan atalan

RE: Macro to export catia v5 points coordinates to excel
(in response to Senthil Kumar Ramanathan)

Dear Kumar

I am interrested to know how you have managed to make your macro working to send points from Catia back to Excel.

I wrote your macro but there are an error.  

Cliff told you to do some modification with Geometrical Set but I could not do it. 

Here is your macro

sub catmain()

set objexcel=CreateObject("Excel.Application")

objexcel.Visible=True

Set objWorkbook= objexcel.workbooks.Add()

set objsheet1=objWorkbook.sheets.item(1)

objsheet1.name="Points_Coordinates"

dim coords(2) as variant

catia.activedocument.selection.search"CATPrtsearch.point,all"

for i=1 to catia.activedocument.selection.count

set selection=catia.activedocument.selection

set element=selection.item(i)

set point=element.value

point.getcoordinates(coords)

objsheet1.cells(i+1,1)=point.name

objsheet1.cells(i+1,2)=coords(0)

objsheet1.cells(i+1,3)=coords(1)

objsheet1.cells(i+1,4)=coords(2)

next i

end sub

 

Thank You for your feedback

Cliff Johnson, Cliff

RE: Macro to export catia v5 points coordinates to excel
(in response to hakan atalan)

What is the error message?

hakan atalan

Macro to export catia v5 points coordinates to excel
(in response to Senthil Kumar Ramanathan)
Cliiff

Thank you very much I manage to get it work.I found later the fully working version

Have nice week end.

Hakan Atalan

Sent from my BlackBerry 10 smartphone.
From: Cliff Johnson, Cliff
Sent: 3 Ekim 2014 Cuma 20:45
To: [login to unmask email]
Reply To: [login to unmask email]
Subject: [devanddepforum] - RE: Macro to export catia v5 points coordinates to excel


What is the error message?


-----End Original Message-----

Rob Snodgrass

RE: Macro to export catia v5 points coordinates to excel
(in response to hakan atalan)

This is something thats currently of great interest to me...especially being able to get point coordinates from the active axis system. Unfortunately, I cannot access the link that Dave provided earlier. Anyone else able to confirm the link is still valid? Perhaps willing to send me the download itself?

Thanks in advance!

Dave Frank

RE: Macro to export catia v5 points coordinates to excel
(in response to Rob Snodgrass)

http://www.coe.org/p/fo/st/topic=113&post=64316#p64316




Dave Frank  *    Aerospace Dynamics International, Valencia, Ca

5-Axis CNC Programmer

COE Product Co-Chairman, Digital Numerical Control

 

Rob Snodgrass

RE: Macro to export catia v5 points coordinates to excel
(in response to Dave Frank)

Thanks Dave! I was able to download the zip file fine from home. Download URL must be blocked by the ever-present and all-knowing IT dept :)

Dave Frank

RE: Macro to export catia v5 points coordinates to excel
(in response to Rob Snodgrass)

Off topic, I am trying to add a tool length Via g-code on an 840D

T1M6

 T1 $TC_DP6=7.5 ????

 do you know how to do that?

 

 


Dave Frank  *    Aerospace Dynamics International, Valencia, Ca

5-Axis CNC Programmer

COE Product Co-Chairman, Digital Numerical Control

 

Rob Snodgrass

Macro to export catia v5 points coordinates to excel
(in response to Dave Frank)
I can get you that info first thing in the morning. What's the best way to take this offline?

Best regards,

Rob Snodgrass

Sent from my iPad

> On Apr 27, 2016, at 4:57 PM, Dave Frank <[login to unmask email]> wrote:
>
> Off topic, I am trying to add a tool length Via g-code on an 840D
>
> T1M6
>
> T1 $TC_DP6=7.5 ????
>
> do you know how to do that?
>
>
>
>
>
> Dave Frank * Aerospace Dynamics International, Valencia, Ca
>
> 5-Axis CNC Programmer
>
> COE Product Co-Chairman, Digital Numerical Control
>
>
>
>
> Site Links: View post online View mailing list online Start new thread via email Unsubscribe from this mailing list Manage your subscription
>
> Use of this email content is governed by the terms of service at:
> http://www.coe.org/p/cm/ld/fid=2

Dave Frank

RE: Macro to export catia v5 points coordinates to excel
(in response to Rob Snodgrass)

my yahoo account

dave_pacmen


Dave Frank  *    Aerospace Dynamics International, Valencia, Ca

5-Axis CNC Programmer

COE Product Co-Chairman, Digital Numerical Control

 

Mark Laspia

RE: Macro to export catia v5 points coordinates to excel
(in response to hakan atalan)

I tried this code also and got an error stating method Search of object Selection failing. I’m presuming the problem is with the line,

CATIA.ActiveDocument.Selection.Search "CATPrtSearch.Point,all"

Can anyone help with this error.

Thank-you

Edited By:
Mark Laspia[Subscriber Members] @ Feb 23, 2019 - 06:54 PM (America/Eastern)