Giter Site home page Giter Site logo

Comments (2)

wwmayer avatar wwmayer commented on May 28, 2024

Create a sketch with this code snippet:

doc = App.newDocument()
body = doc.addObject('PartDesign::Body','Body')
sketch = body.newObject('Sketcher::SketchObject','Sketch')
sketch.AttachmentSupport = (doc.getObject('XY_Plane'),[''])
sketch.MapMode = 'FlatFace'

geoList = []
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-66.131020, -10.357095, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 3.409007), 4.279981, 7.507065))
geoList.append(Part.LineSegment(App.Vector(-76.131020, 7.380997, 0.000000), App.Vector(-77.321495, -31.666620, 0.000000)))
sketch.addGeometry(geoList, False)
del geoList

sketch.addConstraint(Sketcher.Constraint('Vertical', 1))
sketch.addConstraint(Sketcher.Constraint('Distance',0,1,1,8.571427))
sketch.setDatum(1,App.Units.Quantity('8.571430 mm'))
doc.recompute()

Edit the sketch and do a fit all if needed. Trying to move the datum constraint causes totally un-intuitive behaviour. Moving the mouse to up or down moves the label to left or right. Moving the mouse to right or light moves the label to bottom or top.

Furthermore the helper circle is confusing and doesn't add any valuable information.

from freecad.

wwmayer avatar wwmayer commented on May 28, 2024

Second example:

doc = App.newDocument()
body = doc.addObject('PartDesign::Body','Body')
sketch = body.newObject('Sketcher::SketchObject','Sketch')
sketch.AttachmentSupport = (doc.getObject('XY_Plane'),[''])
sketch.MapMode = 'FlatFace'

geoList = []
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-44.226295, 6.428696, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 21.102344), 1.058407, 3.648143))
geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(-26.250109, -12.261777, 0.000000), App.Vector(0.000000, 0.000000, 1.000000), 7.622766), 4.037648, 6.851029))
sketch.addGeometry(geoList,False)
del geoList

sketch.addConstraint(Sketcher.Constraint('Distance',0,3,1,18.309396))
sketch.setDatum(0,App.Units.Quantity('18.309400 mm'))
doc.recompute()

This adds a distance constraint between the center point of the big circle and the shape of the small circle. Showing the helper circle for the small one is OK but I don't think the helper circle of the big one is anyhow helpful because the constraint reference a point of this circle and not its shape.

from freecad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.