Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to remove geoset

Status
Not open for further replies.

Caddish

Automotive
Nov 13, 2015
2
US
I'm trying to do a macro that will remove the selected geo set while keeping the content.
There is already a function in Catia that does this called "Remove Geographical Set" but the macro recorder does not catch it and I can't find it in HybridBody objects

Alternatively I was thinking of manually moving everything in the GS before it and then deleting it but it's a bit past my skill.

Anyone able to help me ? I'm experienced in VBA/VB.Net but totally new to Catia API so any exemple is welcome

Thanks !
 
Replies continue below

Recommended for you

Remove Geoset will only remove the geoset...not the features inside...I think you can access it from the StartCommmand. Look at View > Command List to see the strings for StartCommand. If you want to delete the stuff inside you can delete the geoset and it will automatically delete everything inside...beware, if any other features are children to the ones you deleted, they will not update.

In its simplest form:

Code:
'load part and add geoset to selection then run macro
sub RemoveGeoset()

If Catia.activedocument.Selection.count > 1 then
[indent]CATIA.StartCommand ("Remove Geographical Set")[/indent]
End if

end sub

To delete the geoset:
Code:
'load part and add geoset to selection then run macro
sub DeleteGeoset()

If Catia.activedocument.Selection.count > 1 then
[indent]CATIA.activedocumnet.selection.delete ("Remove Geographical Set")[/indent]
End if

end sub

It would be worth you looking at the V5Automation.chm file to get started with CATIA macros.
 
@lardman

Thanks ! I did not know about CATIA.StartCommand. I have browsed V5Automation.chm but it is a mess (least compared to Solidworks Api Help)

@ferdo

It is a GSD geoset either in a catpart windows or in a catpart in a catproduct with Catia V5 and VBA
 
Hi,

The logical process should be (and is not quite all):

- select the GS
- copy everything inside
- get the name of GS
- activate the CATPart where is this GS
- create a new temporary GS
- select the new GS and paste everything from memory inside
- search and delete old GS, you already know the name

Simple, isn't it? Parts of all this process can be found in V5Automation.chm or CATIA_Portable_Script_Center.



Regards
Fernando

- Romania
- EU
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top