Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Attaching / Detaching Shared SketchPoints with Solver-Problematic SketchCurves

william-c-anderson
Advocate

Attaching / Detaching Shared SketchPoints with Solver-Problematic SketchCurves

william-c-anderson
Advocate
Advocate

I'm in the last furlong of development for an add-in which uses program-generated SketchFittedSplines. I'm now down to a single issue: how to manage SketchPoints which are shared between my program-generated SketchFittedSplines and more solver-problematic SketchCurves (e.g. SketchArcs). Here's a summary:

  • if there is a constraint (e.g. Coincident, Symmetry) between a spline-internal SketchPoint, it is either ignored because it is solver-benign, or it is removed and then reinstated after the move. No problem.
  • if one of the spline-internal SketchPoints is shared with another SketchCurve, problems arise only when the sketch solver has a priority conflict with the particular external SketchCurve (I've written a note on this already). SketchArcs can be particularly problematic.

So, here is what I hope is a simple question: How do I programmatically "detach" (and later reattach) a shared point from my spline SketchPoint, so i can move it without the sketch solver thwarting my intent?

0 Likes
Reply
1,126 Views
11 Replies
Replies (11)

william-c-anderson
Advocate
Advocate

Can anyone at ADSK help me here? What I am asking for is the ability in the API to do what is trivial in the UI, namely take two lines (e.g. one a spline, one an arc) which have a coincidence constraint at a point (i.e. share a SketchPoint):

  1. remove their "coincidence constraint", ending up with two separate SketchPoints, one attached to either curve
  2. move one curve (SketchPoint.move())
  3. then reattach the second curve (SketchPoint.merge()).

Steps 2 and 3 are clear, but I am unclear on how to proceed with step 1.

0 Likes

JesusFreke
Advocate
Advocate

I don't have any experience specifically with the apis around sketch constraints, but it seems like you could delete the constraint via the deleteMe() method, do your modifications, and then recreate the constraint?

0 Likes

william-c-anderson
Advocate
Advocate

You cannot delete a shared SketchPoint like a Coincident constraint. While the UI makes it seem like they are the same thing, they are not.

0 Likes

JesusFreke
Advocate
Advocate

I was suggesting deleting the constraint, not the point. 

0 Likes

william-c-anderson
Advocate
Advocate

There is no constraint on the SketchPoint - it is shared, e.g.:

SketchPoint_var.geometricConstraints.count == 0
SketchPoint_var.connectedEntities.count == 2
SketchPoint_var.connectedEntities.item(0) == <SketchFittedSpline_var>
SketchPoint_var.connectedEntities.item(1) == <SketchArc_var>

 You cannot delete something that is not there...

0 Likes

MichaelT_123
Advisor
Advisor

Hi Mr William-C-Anderson,

 

Your logic here pointing you in the wrong direction. I am not on the mission of converting anyone,... so please take it lightly and consider this metaphor:

ANDLETSTHEREBELIGHT

ANDLETTHEREBESTARS

ANDLETTHEREBEEARTH

ANDLETTHEREBESKY

The SKY can not exist without EARTH, earth without ...

 

Now let's consider THE SKETCH.

ANDLETTHEREBEPOINT

ANDLETTHEREBELINE

ANDLETHTEREBEPATH

Lines existence depend upon points. Whence, when they got them, they keep them. You can not detach them without affecting their very existence.

In your case, whence the line and the spline got their particular constitution points they will fight to hold them forever. Losing even one of them will mean death.

Conclusion. If two lines (entities) have been created based on a shared point, they can not be separated. One must perish for the other to live, as no one so far been able to detach the point from itself. 

I am not saying it is impossible,  it could be in quantum physics,... another universe,… when miracles happen,…  but so far, my experience does not support such a hypothesis.

 

Regards

MichaelT

MichaelT
0 Likes

william-c-anderson
Advocate
Advocate

The SketchEntities were created separately, then their endpoints were joined in a coincident constraint. WHEN THAT HAPPENS, the F360 code can change that coincident constraint into a shared SketchPoint. And yes, you can separate these shared points in the UI (try it). I'm trying to figure out how to achieve this separation from within the API.

And, I might add, I've got a Bachelor's of Science in Physics from a very good university, and this problem has nothing to do with quantum phenomena...

0 Likes

MichaelT_123
Advisor
Advisor

Hi Mr William-C-Anderson,

 

"Bachelor's of Science in Physics from a very good university, and this problem has nothing to do with quantum phenomena..."

 

Respect, please do not take ALL too seriously. Quantum detachment was a convoluted joke,... or might be not?

 

Regarding the meritum. As per your previous post:

SketchPoint_var.geometricConstraints.count == 0

SketchPoint_var.connectedEntities.count == 2

SketchPoint_var.connectedEntities.item(0) == <SketchFittedSpline_var>

SketchPoint_var.connectedEntities.item(1) == <SketchArc_var>

SketchPoint_var is shared by 2 entities. So if one wants to detach entities one must split the point, or create a new one if the later is not possible in the sketch universe of F360.

 

Regards

MichaelT

 

 

 

MichaelT
0 Likes

william-c-anderson
Advocate
Advocate

Philosophy and humor(?) aside, I'm looking for a practical answer. Clearly what I'm looking for is:

SketchPoint_var.unmerge()

It can easily be done in the UI. How do I do it in the API? 

0 Likes

kandennti
Mentor
Mentor

Hi @william-c-anderson .

 

With pre-selection, unmerge is now possible.
        cmdDef = ui.commandDefinitions.itemById('DeleteCoincidentConstraintCmd')
        cmdDef.execute()

However, since it cannot be used in the middle of processing, it feels useless.
 

I don't know what to do, but why not sketch in the final state after processing it with geometric objects (Line3D, Curve3D) in adsk.core?

 

Sketch is heavy processing.

1 Like

william-c-anderson
Advocate
Advocate

@kandennti -san, THANKS for your answer. It does seem to be a bit useless, as you intimated, unless there is some way to programmatically select a SketchEntity without user interaction. Nonetheless, it gives me a place to look.

 

EDIT: Would this work to "select" a SketchPoint from an API program?

userInterface_var.activeSelections.add(SketchPoint_var)

 

The answer to your question is that in my add-in, there is no final state. My programmatically-generated curves are there to be modified by the user, and to be later changed (which necessitates the SketchPoint.move()). If there were a final state, this add-in would have been finished weeks ago. Because of the idiosyncratic nature of the sketch solver, I have learned more about sketch constraints than I ever wanted to know 🤔

 

The asymmetries in the API, e.g.:

  • I can delete fitpoints from a spline, but not add them
  • I can merge SketchPoints but not unmerge them
  • I can split splines but not join them

seem problematic to this add-in designer. I believe that the API is a key feature of F360; I certainly hope the powers-that-be at ADSK are taking the API seriously. Is there a product manager for the F360 API?

0 Likes