Closed Brent-bai closed 10 months ago
I have tried to set the List type to List
Another problem: IXPart.Bodys[0].Faces return IEnumerable
I think this might be related to threading/COM with those dispatches. Dispatch is what SW provides. To compare the entities I recommend using the IXObject::Equals which will compare dispatches using the ISldWorks::IsSame. This should return true for the same entities even if one of those is __ComObject and other is IFace2
I think this might be related to threading/COM with those dispatches. Dispatch is what SW provides. To compare the entities I recommend using the IXObject::Equals which will compare dispatches using the ISldWorks::IsSame. This should return true for the same entities even if one of those is __ComObject and other is IFace2
IsSame worked! Thank you very much. However, the list.Contains() method cannot be used, so I have to use a LINQ statement instead.
I noticed that the item of ISwBody.Faces is IXFace type, as I convert it to ISwFace using "as", the method Entity.GetDistance() will not obtain the value of two face. I used iModelDoc2.ClosestDistance() instead to resolve this problem. And there is a similar issue. When I added the specified PlanarFaces to the List and when iterating, List.Contains() did not return the correct judgment, resulting in duplicate objects in the list. I used Tag to resove it.
I can not find the reason of it. As a novice in programming, it is possible that I am not familiar with C#, and I hope someone can answer my questions. Thank you.
sw:2021
xcad: 0.8.0 beta 4839