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!

How selected line can be use as a d

Status
Not open for further replies.

Neerajjo

Automotive
Jan 13, 2021
45
IN
How selected line can be use as a direction?
 
Replies continue below

Recommended for you

[highlight #EF2929]From the chm file:[/highlight]

HybridShapeDirection (Object)
Represents the hybrid shape direction feature object.
Role: To access the data of the hybrid shape direction feature object. A direction can be specified using:
A line: the direction is tangent to the line
A plane: the direction is normal to the plane
Its components

see

' 5.1- Creates a cylinder, later which will be used for opening creation as a intersecting profile
Set ObjHybridShapeFactory = ObjPart.HybridShapeFactory
Set ObjHybridShapePointCoord = ObjHybridShapeFactory.AddNewPointCoord(90000, 10000, 0)
Set PointRef = ObjPart.CreateReferenceFromObject(ObjHybridShapePointCoord)
Set Manager = CATIA.ActiveEditor.GetService("RfgService")
Set ObjDirection = Manager.GetReferencePlane(ObjPart, 1, "DECK.2")
Set Direction = ObjPart.CreateReferenceFromObject(ObjDirection)
Set ObjHybridShapeDirection = ObjHybridShapeFactory.AddNewDirection(Direction)
Set ObjHybridShapeCylinder = ObjHybridShapeFactory.AddNewCylinder(PointRef, 2000, 32800, 20, ObjHybridShapeDirection)
Set CylinderRef = ObjPart.CreateReferenceFromObject(ObjHybridShapeCylinder)


Eric N.
indocti discant et ament meminisse periti
 
it says object required.
Capture_r0giu8.png
 
I have tried many times but its not working. please help.
 
Code:
Set PDirection = PartDocument1.Selection

This will make PDirection as Selection... not as the line you select

Look at how you define oPoint

Eric N.
indocti discant et ament meminisse periti
 
Means like I define opoint , same I have to define line also.
 
i made now no error in giving direction,
Capture_glsroq.png



but now line code showing error.
Capture_jltdp9.png
 
now you re passing the reference hybridShapeDirection1 instead of a direction when you're creating the linePtDir

you forgot to turn that ref into a direction using HSF.AddNewDirection(ref)

Eric N.
indocti discant et ament meminisse periti
 
How can i measure angle between lines using macro?
 
Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim hybridShapePointOnCurve1 As HybridShapePointOnCurve
Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromDistance(reference2, reference1, D * i, False)


hybridShapePointOnCurve1.DistanceType = 1


hybridBody1.AppendHybridShape hybridShapePointOnCurve1


part1.InWorkObject = hybridShapePointOnCurve1

' creating plane

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

hybridBody1.AppendHybridShape hybridShapePlaneNormal1

part1.InWorkObject = hybridShapePlaneNormal1

'Intersection curve
Dim hybridShapeIntersection1 As HybridShapeIntersection
Set hybridShapeIntersection1 = hybridShapeFactory1.AddNewIntersection(hybridShapePlaneNormal1, surface)

hybridShapeIntersection1.PointType = 0

hybridBody1.AppendHybridShape hybridShapeIntersection1

part1.InWorkObject = hybridShapeIntersection1

' selecting near curve

Dim hybridShapeNear1 As HybridShapeNear
Set hybridShapeNear1 = hybridShapeFactory1.AddNewNear(hybridShapeIntersection1, hybridShapePointOnCurve1)

hybridBody1.AppendHybridShape hybridShapeNear1

part1.InWorkObject = hybridShapeNear1

' Making tangent curve on near curve



Dim reference21 As Reference
Set reference21 = part1.CreateReferenceFromObject(hybridShapeNear1)


Dim reference22 As Reference
Set reference22 = part1.CreateReferenceFromObject(hybridShapePointOnCurve1)



Dim reference23 As Reference
Set reference23 = part1.CreateReferenceFromObject(hybridShapePlaneNormal1)

Dim hybridShapeLineTangency1 As HybridShapeLineTangency
Set hybridShapeLineTangency1 = hybridShapeFactory1.AddNewLineTangencyOnSupport(reference21, reference22, reference23, 0#, 10#, False)

hybridBody1.AppendHybridShape hybridShapeLineTangency1





'creating line on giving direction

Dim hybridShapeLinePtDir1 As HybridShapeLinePtDir
Set hybridShapeLinePtDir1 = hybridShapeFactory1.AddNewLinePtDir(hybridShapePointOnCurve1, direction, 0#, 5#, False)

Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies1.Item("Geometrical Set.1")

hybridBody2.AppendHybridShape hybridShapeLinePtDir1

part1.InWorkObject = hybridShapeLinePtDir1



'creating angle measure

Dim parameters1 As Parameters
Set parameters1 = part1.Parameters

Dim angle1 As Angle
Set angle1 = parameters1.CreateDimension("", "ANGLE", 0#)

Dim relations1 As Relations
Set relations1 = part1.Relations

Dim formula1 As Formula
Set formula1 = relations1.CreateFormula("Formula.6", "", angle1, "angle(`Geometrical Set.1\hybridShapeLineTangency1` ,`Geometrical Set.1\hybridBody2` ) ")

formula1.Rename "Formula.1"
 
I have made this code but parameter not taking line reference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top