Anyone written a lisp to divide 4 sided shape into two equal areas with vertical line?

Discussion in 'AutoCAD' started by James Maeding, Feb 2, 2005.

  1. maybe for a square, but picture a square, but with one short side, the x analysis falls apart.
    The other issue is that I really need it for more than 4 points, that was just s starting point.
    Correct me if I misunderstood your analysis, its Friday
    thx

    ECCAD <>
    |>Then,
    |>Grab the (4) lines of the object, rotate about the intersection
    |>point, until (top) line is Horizontal. Now, draw the Vertical +/-
    |>from the intersection point to the vectors..Then, rotate the
    |>whole thing back to where it was..
    |>:)
    |>Bob

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 4, 2005
    #21
  2. I like what you did, and that will work much of the time.
    So that is a start and I will write it into a lisp.

    Note that it does not deal with the case where vertex C is below the blue line.
    At least I think....
    I also need to pursue a general formula for many points.
    thx

    "Kent Cooper, AIA" <>
    |>By the way, here's an illustration of how far the intersection of the
    |>diagonals can be from what you want. And this drawing is no
    |>approximation -- it's QUITE accurate. It has nice round number
    |>characteristics (ABCD is exactly 3, w is exactly 2, tanP is exactly 2, tanR
    |>is exactly 6). The y offset ends up being a nice clean (in lisp terms)
    |>
    |>(/ 3.0 (+ 2.0 (sqrt 3)))
    |>
    |>I calculated that to seven decimal places, and used that for offsetting AB.
    |>Boundary made two polylines whose areas were also equal to seven decimal
    |>places (1.5000000).

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 4, 2005
    #22
  3. Here's something that works to split the area in half with a line parallel
    to the first two points you pick. You have to go counterclockwise picking
    the points, or it draws its line outside the quadrilateral (the area between
    the endpoints of the w line and the one it draws is correct, but that won't
    do you much good). And you're right, James, it ignores the possibility that
    AD or BC is too short (if the perpendicular from one of their far endpoint
    to w is less than y). [Watch for word wrap.]

    (defun C:SplitQuadLot (/ ptA ptB ptC ptD basisw angleP angleR tanP tanR
    wholelot yoffset)
    (setq ptA (getpoint "First end of basis edge {go CounterClockWise}: ")
    ptB (getpoint "Other end of basis edge: ")
    ptC (getpoint "Third point continuing around: ")
    ptD (getpoint "Fourth and last point: ")
    basisw (distance ptA ptB)
    angleP (- (angle ptA ptD) (angle ptA ptB))
    angleR (- (angle ptB ptC) (angle ptA ptB))
    tanP (/ (sin angleP) (cos angleP))
    tanR (/ (sin angleR) (cos angleR))
    )
    (setq objsn (getvar "OSMODE"))
    (setvar "OSMODE" 0)
    (command "AREA" ptA ptB ptC ptD "")
    (setq wholelot (getvar "AREA")
    yoffset (/ wholelot (+ basisw (sqrt (+ (- (* basisw basisw) (/ wholelot
    tanP)) (/ wholelot tanR)))))
    )
    (command "LINE" (polar ptA (angle ptA ptD) (/ yoffset (sin angleP)))
    (polar ptB (angle ptB ptC) (/ yoffset (sin angleR))) "")
    (setvar "OSMODE" objsn)
    )
     
    Kent Cooper, AIA, Feb 4, 2005
    #23
  4. ...
    I foresee that it will get a heckuva lot more complicated when the area you
    want to establish can often be fancier than a trapezoid. I also assume you
    sometimes need to do this with lots that include CURVED edges -- another
    order of magnitude (or two) more difficult, if not maybe impossible. But
    keep trying....
     
    Kent Cooper, AIA, Feb 4, 2005
    #24
  5. James Maeding

    ECCAD Guest

    James,
    Must have been a bad day..
    Draw a line from the 'midpoint' of any vector to
    the 'midpoint' of the opposite vector.
    Then, same for other two vectors.
    The area of the (2) boxes on Left = area of
    (2) boxes on right. Draw your 'vertical' line
    +/- from intersection of the first 2 lines.

    Bob
     
    ECCAD, Feb 4, 2005
    #25
  6. I do not have any experience doing legal descriptions in the USA, but I have written several functions to read sides of boundaries.

    And I do not remember anyone that used a splitting or slicing a boundary... is there a chance that you can post an image, so I can understand.

    Have you and others interesting on this particular case, have seen what I did with my application bdivide to solve this and not just simple polygonals/regions?

    I know, here is to get input and open all the possibilities.

    Anyway, I see also that this needs to be a function to be implemented on a particular usage... but when someone will require to divide a complex polyline with curve elements, then give BDivide a try.

    I will upload on my web site, some video examples on how this command works with complex polylines.

    Also the next, update is to allow the command to generate the boundaries not just the division lines [without using bpoly]...

    Well in case someone want to have a look, please visit here:

    http://www.draftteam.com/app.php?id=13&lang=en

    And Jim, if you like the program, a free copy is yours.

    Regards,
    Luis Esquivel
    http://www.draftteam.com
     
    Luis Esquivel, Feb 4, 2005
    #26
  7. Hi Bob,

    Works on a parallelogram and fails in all other cases.

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Feb 4, 2005
    #27
  8. I believe it also works for a trapezoid, or for any quadrilateral where any
    two opposite sides are parallel. (Not that that's going to help the
    original poster very often....)
     
    Kent Cooper, AIA, Feb 7, 2005
    #28
  9. Let me qualify that: I think it works if two opposite sides are parallel AND
    the dividing line intersects both of them somewhere. If the dividing line
    hits non-parallel edges, and goes through the intersection of the
    midpoint-connectors, it won't divide the area in half equally.
     
    Kent Cooper, AIA, Feb 7, 2005
    #29
  10. wow, thanks for the offer.
    I'll pay you if I need it, sales for 3rd party people are hard enough to come by, I'd be happy to pay.
    thx

    Luis Esquivel <>
    |>I do not have any experience doing legal descriptions in the USA, but I have written several functions to read sides of boundaries.
    |>
    |>And I do not remember anyone that used a splitting or slicing a boundary... is there a chance that you can post an image, so I can understand.
    |>
    |>Have you and others interesting on this particular case, have seen what I did with my application bdivide to solve this and not just simple polygonals/regions?
    |>
    |>I know, here is to get input and open all the possibilities.
    |>
    |>Anyway, I see also that this needs to be a function to be implemented on a particular usage... but when someone will require to divide a complex polyline with curve elements, then give BDivide a try.
    |>
    |>I will upload on my web site, some video examples on how this command works with complex polylines.
    |>
    |>Also the next, update is to allow the command to generate the boundaries not just the division lines [without using bpoly]...
    |>
    |>Well in case someone want to have a look, please visit here:
    |>
    |>http://www.draftteam.com/app.php?id=13&lang=en
    |>
    |>And Jim, if you like the program, a free copy is yours.
    |>
    |>Regards,
    |>Luis Esquivel
    |>http://www.draftteam.com

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 9, 2005
    #30
  11. sorry, but isn't the centre of gravity all you need? how hard is that?

    jake
     
    Cut-Throat Jake, Feb 11, 2005
    #31
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.