Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

evRaycast not reporting all face intersections

Cappie_PomeroyCappie_Pomeroy Member Posts: 7 PRO
I'm trying to use evRaycast to get all points where a ray intersects the face of a body.  It mostly seems to be working however I have run into a strange issue.  A single point is missing from what I would expect to be an intersection.  I've included a screenshot where I have circled the "expected point" in black and a link to a document with a simplified version of my script that has the same issue.  Anyone have any insight into this?  Possible workarounds perhaps?  It appears that I can get the point as an EntityType.EDGE intersection.  I want to filter by FACE because  otherwise I end up with a lot of very close duplicate points in the RaycastResult of EDGE as expected.  I would like to avoid filtering in a more computationally intensive way because eventually I will be iterating over thousands of rays.

Document Link:


Thanks!
Cappie



Tagged:

Comments

  • MBartlett21MBartlett21 Member Posts: 1,624 EDU
    @Cappie_Pomeroy
    I also noticed that for edges, it only gives the first intersection with each edge, so if the edge crosses the line twice, it only returns one intersection
    MB - I make FeatureScripts: view FS (My FS's have "Official" beside them)
  • Konstantin_ShKonstantin_Sh Member Posts: 12 PRO
    edited July 10
    I think evRaycast still uses evDistance internally iterating through the list of faces and giving the result with the closest positive parameter so it is not suprizing that it can't find multiple intersections within same face just like evDistance. At least it gives similar perfomance results comparing to that algorhytm.
  • mthiesmeyermthiesmeyer Onshape Employees Posts: 87
    @Cappie_Pomeroy,

    It looks like it may potentially be a tolerance issue. I wiggled your z value by .000001 and got your expected results.

    Best,

    Mike
  • MBartlett21MBartlett21 Member Posts: 1,624 EDU
    @mthiesmeyer
    I was trying evRayCast with a spline that intersected the line twice, but it only gave the closest result, even when 'closest' was set to false
    MB - I make FeatureScripts: view FS (My FS's have "Official" beside them)
  • abovinabovin Member, Onshape Employees Posts: 2
    @Cappie_Pomeroy

    Hey! It looks like I can get all correct intersections if I cast rays on just faces instead of the entire part, i.e., using
    qOwnedByBody(definition.part, EntityType.FACE)
    instead of definition.part. Then you won't have to filter, either.
  • Cappie_PomeroyCappie_Pomeroy Member Posts: 7 PRO
    @MBartlett21 I haven't experimented too much with the edges because I am interested in intersections at an arbitrary plane that I choose so I wont always have an edge.  I did notice the same behavior you're describing though. 

    @Konstantin_Sh I just found it odd that it was inconsistent in the multiple intersection points that it did find.  That one just doesn't seem particularly special in any way.

    @mthiesmeyer I noticed that also, but I am interested in tolerances on the order of 1um so I was hesitant to use that workaround and was hopeful of another way.

    @Anton_Bovin That's a great work around!  It works exactly as expected.

    Update for everyone Onshape has flagged this as a bug and are working on it.  I'll try to remember to post back to this forum when it's fixed.
Sign In or Register to comment.