Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Rollets Macro

Status
Not open for further replies.

ajay2agrawal

Mechanical
Joined
Sep 13, 2017
Messages
3
Location
IN
Hello Everyone,

This is great to be a part of this forum.

I wanted to develop one macro by which one repeated commend can be minimized.
I have some sort of partern which I need to repeater more then 100x time soemtime.

I Made Power copy for it, but its not solving that much time issue.

It will be very help full if any one create Macro from Power copy.

I have also attached presentation for better understanding What I need.


if anyone can help please let me know
 
check InstanceFactory in your V5Automation.chm file...

Eric N.
indocti discant et ament meminisse periti
 
Hi,
i figured it out how to run powercopy from macro, but i never think about to make loop of it. It is kinda interesting approach.

I m think now about it, and have some ideas in my mind. So i guess you first need figure how to run powercopy from macro and then think about this loop.

One more thing, i think you need special licence for this, KT2 or something like this. You can make everything good but without this licence it will not happen.

I think you can control these two inputs with the loop.
Dim Center As Object
Set Center = PartDest.FindObjectByName("Point.1")

Dim Surface As Object
Set Surface = PartDest.FindObjectByName("Surface.1")


 
V5Automation.chm is inside your catia install [...]code/bin folder

Eric N.
indocti discant et ament meminisse periti
 
Thank you guys for fast response

I have tried to write below code but its showing me error.

Sub CATMain()

Dim PartStart As Part
Set PartStart = PartDocumentStart.Part

Dim reference As Object
Set reference = PartStart.FindObjectByName("UserFeature2")

'------------------------------------------------------------------
Catia.SystemService.Print "Instantiate the reference in the current part"

Dim factory As InstanceFactory
Set factory = PartDest.GetCustomerFactory("InstanceFactory")

Dim instance As ShapeInstance
Set instance = factory.AddInstance(reference)

'------------------------------------------------------------------
Catia.SystemService.Print "Set Inputs"

Dim Center As Object
Set Center = PartDest.FindObjectByName("FIRST LINE")

Dim Surface As Object
Set Surface = PartDest.FindObjectByName("Surface.1")

Dim Center As Object
Set Center = PartDest.FindObjectByName("Surface.1\edge.5")

instance.PutInput "FIRST LINE", Center
instance.PutInput "Surface.1", Surface
instance.PutInput "Surface.1\edge.5", Surface

'------------------------------------------------------------------
Catia.SystemService.Print "Modify Parameters"

Dim param1 As Parameter
Set param1 = instance.GetParameter("PITCH")
param1.ValuateFromString("1.5mm")

Dim param2 As Parameter
Set param2 = instance.GetParameter("OFFSET")
param2.ValuateFromString("0.5mm")

Dim param3 As Parameter
Set param3 = instance.GetParameter("FRONT_PARABOLA")
param2.ValuateFromString("0.5mm")


'------------------------------------------------------------------
Catia.SystemService.Print "Update"
PartDest.Update

'------------------------------------------------------------------
Catia.SystemService.Print "Retrieves Inputs and Outputs"

Dim inputCentre As Object
Set inputCentre = instance.GetInput("LINE")
Dim inputSurface As Object
Set inputSurface = instance.GetInput("Surface")

Catia.SystemService.Print "Retrieve outputs"
Dim outputDirection As Object
Set outputDirection = instance.GetOutput("Direction")

'------------------------------------------------------------------
Catia.SystemService.Print "Close the CATPart containing the reference"
PartDocumentStart.Close

End Sub

I am pretty new to this VB scripting ,can any one suggest
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top