Intersect Operation with Linked model

Intersect Operation with Linked model

pmcmm1
Enthusiast Enthusiast
1,895 Views
6 Replies
Message 1 of 7

Intersect Operation with Linked model

pmcmm1
Enthusiast
Enthusiast

Dear colleagues,

 

I'm facing some issues detecting intersections between elements in different models using linked models. Im using the following function:

SetComparisonResult result = face.Intersect(curve, out intersection_points);

And everything works well, as long as the internal origin points are matching. If they don't then it doesn't work at all.

I came to the conclusion that the operations are performed taking as reference the internal origin points of each model (see below). So it doesn't really matter if the PBP are matching, or where the linked model really is in the screen.

 

The question is then how to solve this efficiently. I could still get the operations done by moving the elements before the operation to ensure that PBP are matching, but that seems to me that it will quickly make the calculation unnecessarily heavy. do you know of an easier way to achieve this?

PS.png

 

Regards,

Pedro

0 Likes
Accepted solutions (1)
1,896 Views
6 Replies
Replies (6)
Message 2 of 7

Moustafa_K
Collaborator
Collaborator
Accepted solution

I am not sure this is the best way, but see this

  1. extract both objects Solids. (Solid1=current document, Solid2=> LinkedDocument) 
    var geo1 = LinkedElement1.get_Geometry(op);
    var solids = geo1.Where(o => o is Solid)
  2. loop through each solid that has a volume greater than 0
  3. get Inverse Transform of the linked Document 
    var trans = rlinks.GetTotalTransform().Inverse
  4. Clone Transformed Linked Solid (Solid2) , 
    SolidUtils.CreateTransformed(s, trans);
  5. now check boolean intersection if it has a volume greater than 0, then there is intersection
    var intersectionSolidsResult = BooleanOperationsUtils.ExecuteBooleanOperation(Solid1, Solid2,									BooleanOperationsType.Intersect);
Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 3 of 7

pmcmm1
Enthusiast
Enthusiast

Thanks a lot for the reply Mostapha. This indeed works and that is how I implemented it at the moment but, as expected, it made the calculation much heavier:

1. duplicate all elements from linked model and commit changes

2. find all intersections

3. place elements in those positions and commit

4. delete elements created in step 1 and commit

 

So right now I am committing 3 changes to the model, whereas I only need one.

 

I wonder if there is a quicker way to achieve this.

0 Likes
Message 4 of 7

Moustafa_K
Collaborator
Collaborator
Indeed, that's why I am not sure it is the best way to get it.

So glad it works for you as of now.
Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 5 of 7

jeremytammik
Autodesk
Autodesk

SolidUtils creates a geometrical solid in memory only, not a database element.

 

Hence, I see no need to commit anything.

 

Is that really required?

 

Without all the transaction handling you describe, it should be much faster.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 7

Moustafa_K
Collaborator
Collaborator

Thanks @jeremytammik , of Course Committing Transaction is not required. I am only not sure if there a better approach to identify collision with linked model via  intersection result, other than converting them to solid. as sometimes the boolean operation returns this exception.


Failed to perform the Boolean operation for the two solids. This may be due to geometric inaccuracies in the solids, such as slightly misaligned faces or edges. If so, eliminating the inaccuracies by making sure the solids are accurately aligned may solve the problem. This also may be due to one or both solids having complexities such as more than two faces geometrically meeting along a single edge, or two coincident edges, etc. Eliminating such conditions, or performing a sequence of Boolean operations in an order that avoids such conditions, may solve the problem.

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 7 of 7

pmcmm1
Enthusiast
Enthusiast

I realized that myself when I was in bed time. Instead of copy pasting walls and floors, I should be copy pasting memory elements only. Same result but much faster.

 

Thanks a lot for the help guys, I found the solution I wanted.

0 Likes