Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attaching / Detaching Shared SketchPoints with Solver-Problematic SketchCurves

11 REPLIES 11
Reply
Message 1 of 12
william-c-anderson
563 Views, 11 Replies

Attaching / Detaching Shared SketchPoints with Solver-Problematic SketchCurves

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?

11 REPLIES 11
Message 2 of 12

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.

Message 3 of 12

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?

Message 4 of 12

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.

Message 5 of 12

I was suggesting deleting the constraint, not the point. 

Message 6 of 12

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...

Message 7 of 12

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
Tags (3)
Message 8 of 12

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...

Tags (1)
Message 9 of 12

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
Message 10 of 12

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? 

Message 11 of 12

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.

Message 12 of 12

@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?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report