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!

ISSUE IN LINE 55. 1

Status
Not open for further replies.

VGENIUS_05

Mechanical
Sep 7, 2022
6
thread560-473924
I tried to change the input fields but i got error in Line 55...!
Will you please send any reference CATIA file with this VB Script i may try to understand this Scripting, because i'm new to these Scripting. THANKS in ADVANCE...!
 
 https://files.engineering.com/getfile.aspx?folder=435cf10e-ad6f-434c-adfe-612db2e863f2&file=holes_creating_issue_1.JPG
Replies continue below

Recommended for you

It would help if you could post code where you have an issue.
 

LWolf (Automotive)
16 Oct 20 10:00
jzecha...
here are my premises:
I have a set with points called HoleCenterPoints, located directly under part.
I have an empty body called Holes (holes will end up here)
I have an empty set called Hole_References (line normal to surface and plane normal to curve will be added here for each HoleCenterPoint-point).
My surface is a dead one, i.e. a parameter... called InputSurface (I tested the script on a sphere)
Parameters of the holes are metric, you will need to change it according to your needs.
Sub CATMain()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim Sel As Selection
Set Sel = partDocument1.Selection

Dim part1 As Part
Set part1 = partDocument1.Part

Dim hybridBodies1 As hybridBodies
Set hybridBodies1 = part1.hybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.item("Hole_References")

part1.InWorkObject = hybridBody1

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim parameters1 As Parameters
Set parameters1 = part1.Parameters

Dim hybridShapeSurfaceExplicit1 As HybridShapeSurfaceExplicit
Set hybridShapeSurfaceExplicit1 = parameters1.item("InputSurface")

Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies1.item("HoleCenterPoints")

Dim myHybridShape As HybridShape

Dim coord(2)

Dim bodies1 As Bodies
Set bodies1 = part1.Bodies

Dim body1 As Body
Set body1 = bodies1.item("Holes")

For Each myHybridShape In hybridBody2.HybridShapes

myHybridShape.GetCoordinates coord

Dim hybridShapeLineNormal1 As HybridShapeLineNormal
Set hybridShapeLineNormal1 = hybridShapeFactory1.AddNewLineNormal(hybridShapeSurfaceExplicit1, myHybridShape, 0, 20, False)

Dim hybridShapePlaneNormal1 As HybridShapePlaneNormal
Set hybridShapePlaneNormal1 = hybridShapeFactory1.AddNewPlaneNormal(hybridShapeLineNormal1, myHybridShape)

hybridBody1.AppendHybridShape hybridShapePlaneNormal1


part1.InWorkObject = hybridShapePlaneNormal1
part1.UpdateObject hybridShapePlaneNormal1

part1.InWorkObject = body1

Dim shapeFactory1 As ShapeFactory
Set shapeFactory1 = part1.ShapeFactory

Dim hole1 As Hole
Set hole1 = shapeFactory1.AddNewHoleFromPoint(coord(0), coord(1), coord(2), hybridShapePlaneNormal1, 10)

hole1.Type = catSimpleHole
hole1.AnchorMode = catExtremPointHoleAnchor
hole1.BottomType = catVHoleBottom

Dim limit1 As Limit
Set limit1 = hole1.BottomLimit
limit1.LimitMode = catOffsetLimit

Dim length1 As Length
Set length1 = hole1.Diameter
length1.Value = 10

Dim angle1 As Angle
Set angle1 = hole1.BottomAngle
angle1.Value = 120

hole1.SetDirection hybridShapeLineNormal1
hole1.ThreadingMode = catSmoothHoleThreading
hole1.ThreadSide = catRightThreadSide
part1.UpdateObject hole1

Sel.Clear
Sel.Add hybridShapePlaneNormal1
Sel.Add hybridShapeLineNormal1
Set visPropertySet1 = Sel.VisProperties
visPropertySet1.SetShow 1
Next

End Sub

regards,
LWolf
 
In the above reply I have highlighted the Errors I got stuck and I don't know to make the line normal to surface and plane normal to cure. I can't do as mentioned in the script...! please help to sort out this...!
 
I'm working With Hybrid Mode...! I'll check out your videos...! Thanks Man...!
 
Im using Catia v5 r21 version these video links you sent is having only 3Dexperience bro...!
@Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor