×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATIA V6 Plane repitition

CATIA V6 Plane repitition

CATIA V6 Plane repitition

(OP)
Hi!

I'm looking for a script or macro which allows me to create planes on all points and a curve i have made.

I have a excel file with xyz coordinates which I import into Catia (V6 GSD) creating a geometrical set called "GeometryFromExcel". This geometrical set contains all points and creates a spline through all these points.

I want to create planes on every single point regardless of its name (example: Point.1 or point.50 shouldnt matter). Using the "normal to curve" function of planes.

The amount of points may vary.
Hope you guys can help out!

Cheers

RE: CATIA V6 Plane repitition

do you import excel points into V6 with a script?

Eric N.
indocti discant et ament meminisse periti

RE: CATIA V6 Plane repitition

(OP)
I Do. I use the script which is already in Catia. I believe its called : GSD_PointSplineLoftfromExcel.xls

RE: CATIA V6 Plane repitition

why don't you modify it to create the plane?

Eric N.
indocti discant et ament meminisse periti

RE: CATIA V6 Plane repitition

(OP)
I would not know how..

RE: CATIA V6 Plane repitition

(OP)
So basically i want to have a set of planes all offset from the XY plane which can be made using a txt file or excel file.

I've tried to record my own macro but i do not know how to get it to loop...
As written above, I do have a way to input points and a line using a excel table.. just not the planes yet.


CODE -->

Sub CATMain()

Dim editor1 As Editor
Set editor1 = CATIA.ActiveEditor

Dim part1 As Part
Set part1 = editor1.ActiveObject

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("GeometryFromExcel")

Dim hybridShapes1 As HybridShapes
Set hybridShapes1 = hybridBody1.HybridShapes

Dim hybridShapeSpline1 As HybridShapeSpline
Set hybridShapeSpline1 = hybridShapes1.Item("Spline.1")

Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromObject(hybridShapeSpline1)

Dim hybridShapePointCoord1 As HybridShapePointCoord
Set hybridShapePointCoord1 = hybridShapes1.Item("Point.1")

Dim reference2 As Reference
Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord1)

Dim hybridShapePlaneNormal1 As HybridShapePlaneNormal
Set hybridShapePlaneNormal1 = hybridShapeFactory1.AddNewPlaneNormal(reference1, reference2)

hybridBody1.AppendHybridShape hybridShapePlaneNormal1

part1.InWorkObject = hybridShapePlaneNormal1

part1.Update

Dim settingControllers1 As SettingControllers
Set settingControllers1 = CATIA.SettingControllers

Dim settingRepository1 As SettingRepository
Set settingRepository1 = settingControllers1.Item("VPMEditorDisplay")

boolean1 = settingRepository1.GetAttr("Mask_LockEditability")

End Sub 

RE: CATIA V6 Plane repitition

the loop should be around

hybridShapes1.Item("Point.1")


you can loop all element in hybridShapes1 and test if you have a point

CODE --> catvba

for each oShape in hybridShapes1

 if typename(oShape) = "Point" then

Set hybridShapePointCoord1 = oShape

[...]


next 

that should take all points in that geometrical set

Eric N.
indocti discant et ament meminisse periti

RE: CATIA V6 Plane repitition

(OP)
I now have below code. It doesnt give an error but doesnt do anything either. I'm sorry for being such a newbie at scripting..

CODE -->

Sub CATMain()

Dim editor1 As Editor
Set editor1 = CATIA.ActiveEditor

Dim part1 As Part
Set part1 = editor1.ActiveObject

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("GeometryFromExcel")

Dim hybridShapes1 As HybridShapes
Set hybridShapes1 = hybridBody1.HybridShapes

Dim hybridShapeSpline1 As HybridShapeSpline
Set hybridShapeSpline1 = hybridShapes1.Item("Spline.1")

Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromObject(hybridShapeSpline1)

Dim hybridShapePointCoord1 As HybridShapePointCoord

For Each oShape In hybridShapes1

If TypeName(oShape) = "Point" Then

Set hybridShapePointCoord1 = oShape

Dim reference2 As Reference
Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord1)

Dim hybridShapePlaneNormal1 As HybridShapePlaneNormal
Set hybridShapePlaneNormal1 = hybridShapeFactory1.AddNewPlaneNormal(reference1, reference2)

hybridBody1.AppendHybridShape hybridShapePlaneNormal1

part1.InWorkObject = hybridShapePlaneNormal1

part1.Update

Dim settingControllers1 As SettingControllers
Set settingControllers1 = CATIA.SettingControllers

Dim settingRepository1 As SettingRepository
Set settingRepository1 = settingControllers1.Item("VPMEditorDisplay")

boolean1 = settingRepository1.GetAttr("Mask_LockEditability")

End If
Next
End Sub 

RE: CATIA V6 Plane repitition


insert

CODE -->

MsgBox (TypeName(oShape)) 

before

CODE -->

If TypeName(oShape) = "Point" Then 

this will help you find the type of point

once you have it replace

CODE -->

If TypeName(oShape) = "Point" Then 

with the proper Type.

do this with a small number of points in your file.

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources