Second Method – Replace Elements with Join
Advantage: faster and more stable as the first method (no need for Win32 API-Function)
Disadvantage: elements must be joinable, so you can’t use e.g. points or planes; exklusive parents can’t be deleted automaticly
insert this procedure in a public module
the procedure need 2 parameters:
1. MyJoinToRefresh [Join] – Join, which elements should be replaced
2. MyJoinNewInput [Join] – elements of this join will be replace the elements of MyJoinToRefresh
Sub JoinReplace(MyJoinToRefresh As HybridShapeAssemble, MyJoinNewInput As HybridShapeAssemble) Dim JoinElement As Reference ' delete all old elements For i = 1 To MyJoinToRefresh.GetElementsSize 'To elements count MyJoinToRefresh.RemoveElement 1 Next ' read new elemnts and add to join For i = 1 To MyJoinNewInput.GetElementsSize Set JoinElement = MyJoinNewInput.GetElement(i) MyJoinToRefresh.AddElement JoinElement Next MyPart.UpdateObject MyJoinToRefresh 'update ' MyJoinNewInput delete Set ObjektReferenz = MyPart.CreateReferenceFromObject(MyJoinNewInput) MyHybShapeFactory.DeleteObjectForDatum MyJoinNewInput End Sub
Example to insert the procedure into your own code:
JoinReplace MyJoin, MyJoin2