-
Re: get sketch point using SelectByID2 within AssemblyDoc
Simon Turner May 22, 2015 9:52 AM (in response to Michael Deng)Why use SelectByID2? Why not just SketchPoint.Select4
You can work out the name of the point with SketchPoint.GetID
But if you have the SketchPoint object, then just select it with Select4
-
Re: get sketch point using SelectByID2 within AssemblyDoc
Michael Deng May 22, 2015 10:20 AM (in response to Simon Turner)Thank you Simon.
After select the SketchPoint , I want to use AddMate funtion,so I have to work out the name of point. I do not quite understand how to obtain the name
with SketchPoint.GetID, for its Return Value is "Array with two longs identifying this sketch point ID",not the BSTR type that required in AddMate.
Could you provide an example of SketchPoint.GetID to get the name ?
-
Re: get sketch point using SelectByID2 within AssemblyDoc
Simon Turner May 22, 2015 10:25 AM (in response to Michael Deng)I still don't see why you need to know the name? AddMate works off whatever you have selected, regardless of how you selected it.
Anyway, the point will always be called something like "Point1", "Point2" etc.
One of the integers returned by GetID is the number to use
-
-
-
Re: get sketch point using SelectByID2 within AssemblyDoc
Keith Rice May 23, 2015 3:20 PM (in response to Michael Deng)Your challenge is to determine what criteria to use to locate this sketch point. You haven't told us anything about this sketch point so it's hard to offer any advice. For example, if you knew your sketch point was at the origin in a sketch called "Sketch1" in a component called "Part1" then I could explain how to locate that component, then locate that sketch, then locate that sketch point, bring its pointer into the assembly context (if ncessary), and then select it using ISketchPoint::SelectX.
By the way, I have a blog post called "Mating Automation Techniques: Pros and Cons" at my web site that you might find helpful.
Keith
-
Re: get sketch point using SelectByID2 within AssemblyDoc
Michael Deng May 22, 2015 11:11 PM (in response to Keith Rice)Thanks Keith.
After reading your suggestion, I have managed to select the sketch point and add mate on it.However,the mate direction is opposite,how to
reserve it and make it right ?
-
Re: get sketch point using SelectByID2 within AssemblyDoc
Keith Rice May 23, 2015 3:23 PM (in response to Michael Deng)If you're talking about reversing the direction of a distance or angle mate, you will need to use IMate2::Flipped. If you're talking about alignment, you will need to use IAssemblyDoc::EditMateX, which I also discuss at that blog post I linked to in my last response.
Keith
-
-