What's new

Request for enhancement

bolsover

Senior Member
For a sketch to be fully defined, it is generally necessary to add a number of dimensions to the sketch features.
Currently, there are just 3 methods for adding dimensions:

Code:
void  AddDimension (Circle Circle)
  Adds a dimension to the radius of a circle More...
 
 
void  AddDimension (CircularArc Arc)
  Adds a dimension to the radius of an arc More...
 
 
void  AddDimension (SketchPoint P1, SketchPoint P2)
  Adds a dimension to the sketch between two points More...

The problem I'm facing is that I need to be able to add horizontal and vertical measurements between two points.
An additional method with the following signature would do the trick nicely:

Code:
void AddDimension(SketchPoint P1, SketchPoint P2, int direction)

Doubtless there are several other addDimension functions that would also be of value.

DB
 

NateLiquidGravity

Alibre Super User
I've suggested a similar enhancement before. Also the ability to dimension a point at a perpendicular distance from a line is another common type needed.
 

bolsover

Senior Member
Hi Nate
I 'solved' the problem by adding an otherwise redundant reference sketch point with appropriate constraints and then dimensioning from there..

Code:
  def drawCircle(self):
    #add circle to sketch
    circlea = Circle([1,1],5,False)
    circlea = self.sketch.AddCircle(circlea)
        
    #add reference point and constraints for dimensions
    pointa = SketchPoint(0,1,True)
    pointa = self.sketch.AddPoint(pointa)
    self.sketch.AddConstraint([pointa, circlea.CenterPoint],Sketch.Constraints.Horizontal)
    self.sketch.AddConstraint([pointa, self.sketch.Origin],Sketch.Constraints.Vertical)
    
    #add dimensions
    self.sketch.AddDimension(circlea)
    self.sketch.AddDimension(pointa, circlea.CenterPoint)
    self.sketch.AddDimension(pointa, self.sketch.Origin)

It's messy - but at least I can get a fully defined sketch.
I'll wrap the idea up in a utility method so I can just make a call to AddDimensions...
Actually here's a possible solution:

Code:
def addDimensions(self, sketch, point):
    #add reference point vertical to origin and horizontal to point to be dimensioned
    pointa = SketchPoint(0,point.Y,True)
    pointa = sketch.AddPoint(pointa)
    
    #add constraints
    sketch.AddConstraint([pointa, point],Sketch.Constraints.Horizontal)
    sketch.AddConstraint([pointa, sketch.Origin],Sketch.Constraints.Vertical)
    
    #add dimensions
    sketch.AddDimension(pointa, point)
    sketch.AddDimension(pointa, sketch.Origin)
 

NateLiquidGravity

Alibre Super User
Right, but these things are already function solved in Alibre and shouldn't have to be solved by us again. Same with adding a radius to two arbitrary non-parallel lines. I made my own function to mathematically do it but it should just be built in. Most users aren't as proficient or determined as us.
 
Top