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.

Why are sketch entities so different from world entities?

brooks_talleybrooks_talley Member Posts: 27
Probably not the right forum, but I'm encountering this while working on Featurescript.

I'm sure there's a good underlying reason for it, but I'm baffled by why entities that seem to be the same are really very different if they're in the context of a 2D sketch or the 3D world. For instance, you can extrude a straight line in a sketch into a planar surface, but you cannot extrude a 3D line. 

I get that I can write Featurescript to enable this kind of thing, but I keep finding the pattern of writing if-then to take different actions on sketch objects that are geometrically the same thing as world objects (I think).

Probably I'm missing something and there is either 1) a general purpose solution where Featurescript can operate on geometry in the abstract without worrying about how it was created, or 2) some fundamental reason why this isn't possible, which is at the root of why the UI's Extrude supports sketch-lines but not world-lines.

Can one of you enlighten me?

Comments

  • lanalana Onshape Employees Posts: 706
    edited September 2017
    Actually, you can extrude a 3d line in Featurescript, if you call opExtrude and specify extrusion direction. Sketch curves are different only in a sense that they have a sketch plane associated with them. When writing custom feature we recommend that you use operations rather than features ( opExtrude vs. extrude). One of the reasons that the operations interface is often more general. What are other cases when you had to treat sketch objects differently?
  • brooks_talleybrooks_talley Member Posts: 27
    Thanks! I had not appreciated the difference between extrude() and opExtrude. That helps.

    The other recent example was getting the normal vector from a 2D curve; I ended up using evOwnerSketchPlane if it's a sketch object, and creating a plane() based on the start, end, and middle vertices of the if not. That may have been the really hard way to do it as well; hence the overall question.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    The other recent example was getting the normal vector from a 2D curve; I ended up using evOwnerSketchPlane if it's a sketch object, and creating a plane() based on the start, end, and middle vertices of the if not. That may have been the really hard way to do it as well; hence the overall question.
    if the line is not a sketch object you can get some arbitary normal vector using normalVector() function
  • brooks_talleybrooks_talley Member Posts: 27
    Ah, cool. Thanks for that! It still feels weird to have to know how an object was created, but I'm at least understanding how to deal with the pattern more cleanly.
Sign In or Register to comment.