×
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

hybridshapeintersection

hybridshapeintersection

hybridshapeintersection

(OP)
Hai,
I have a Geometrical Set Containing Lines and a Surface in other Geometrical Set. All the Lines in the Geometrical Set doen't Intersect with the surface which i select. I want the intersection result of all the lines which intersect with the surface excluding the Lines which doen't intersect. How to do this using Catvba......Please Help.I am in urgent need....

RE: hybridshapeintersection

Hi,

Try this,,
I've not tried this but sure that this works..
If its not working then try to modify it to suit to your need, functions works though

CODE --> CATVBA

Dim oPart
Dim oGeometricalSetWithCreatedIntersection As HybridBody
Dim oSurface As HybridShape
Dim oLine As HybridShape
Dim oGeoSetWithLines As HybridBody

Set oPart = CATIA.ActiveDocument.Part
' Get All the Lines 
Set oGeometricalSetWithCreatedIntersection = .............. ' Add the geoset to which you want your intersection to get appended
Set oGeoSetWithLines = ............ '- Add your code here
Set oSurface = ................... '- Add the surface to this variable

If Not oGeoSetWithLines.Count = 0 Then
	For Each oLine In oGeoSetWithLines
		CreateIntersection oSurface, oLine, oGeometricalSetWithCreatedIntersection
	Next
End If 
'--- Code

Sub CreateIntersection (obj1 As Object, obj2 As Object, oGeoSetToAppend As HybridBody)
	If Not (obj Is Nothing) And (obj2 Is Nothing) Then
		Dim bIntersectsWithEachOther As Boolean
		bIntersectsWithEachOther = CheckIntersection (obj1, obj2)
		If bIntersectsWithEachOther Then
			call AddIntersection (obj1, obj2, oGeoSetToAppend)
		End If
	Else
		MsgBox "One of the Item sent for creating intersection is missing",VbOKOnly,"Create Intersection Failed"
	End If
End Sub
Sub AddIntersection (obj1 As Object, obj2 As Object, oAppendTo As HybridBody )
	Dim ref1 As Reference
	Set ref1 = oPart.CreateReferenceFromObject(input1)
	Dim ref2 As Reference
	Set ref2 = oPart.CreateReferenceFromObject(input2)
	Dim new_int As HybridShapeIntersection
	Set new_int = CurHSFactory.AddNewIntersection(ref1, ref2)
	oAppendTo.AppendHybridShape new_int
	oPart.UpdateObject new_int
End Sub
' CheckIntersection
Function CheckIntersection(Object1 As Variant, Object2 As Variant) As Boolean
	On Error GoTo Blast
	Dim TestInt As HybridShapeIntersection
	Dim oSel As Variant
	Set oSel = CATIA.ActiveDocument.Selection
	Set TestInt = MyHSFactory.AddNewIntersection(Object1, Object2)
	CATIA.ActiveDocument.Part.UpdateObject TestInt
	CheckIntersection = True
	' Delete the intersection otherwise it will get embedded into the document 
	' though user cant see this in tree until it gets appended to a Geometrical Set.
	' later This can only be deleted from using CATDUA tool.
	oSel.Clear
	oSel.Add TestInt
	oSel.Delete
	oSel.Clear
	Exit Function
Blast:
	CheckIntersection = False
End Function 

Hope this might help you.

Regards,
Maddy

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