2 Replies Latest reply on Nov 6, 2014 11:24 AM by roberto gennari

    How Get the dimension created by a sketch offset

    roberto gennari

      Hallo,

      I have a part model with an edit sketch, in this sketch there are some segments with dimensions.

      One of this segment is an offset entities of an edge, and i would like get the value of this,  programmatically, without any selection.

      Is it possible? what's is the best way for get the dimension that I want?

      I know the ID of the line enty.

       

      IMPORTANT:

      The dimension that I would like to retrieve the value entered is the last dimension (of the last one line added us offeset)!

       

      Thanks to every body

      Roberto

        • Re: How Get the dimension created by a sketch offset
          Daniel Andersson

          One idea I have is that you get the relations for the all offsets and then let the code select those two segments in the relation. Once selected (or identified...) you can use the IModelDoc2::ClosestDistance method. It is not that sweet but it does the job.... I modified a macro that is in the API reference so the macro only gets the offset relations and then measures the distances between the related segments.

          Had to add a Round function to it... for some reason it plotted the distance to be 9.9999999mm when it was actually 10mm. So there is something not working properly... Note that I did not debug the macro properly, since it is just to show how it might be done... scripts is out of range time to time etc. etc... Did some tries to debug... but gave up since it just to show the idea.


          You could do this the other way around if you know your specific ID of the segment, then you could loop thru all offset relations until you find a match that has a relation to the specified ID. By doing that you do not have to get all offsets as in the macro...

           

          I also found this post, which would have been a much better approach...