Snap to centre of hatch?

Is it possible to snap to the centre of a hatch? or somehow determine the position of this point?

When I create a hatch and select it, it shows the centre (centroid).

Comments

  • If you are smarter than me you could possibly pick it out of its (entget) properties, but the best I can offer is to draw a closed polyline around it and find the centroid of that.

    I think that ability itself is neat, even better is brushing past the perimeter of something with a centre and osnap cen turned on, highlights the point as you pass it.

  • Additionally to John's comment: use BOUNDARY command to create closed polyline.

    What for hatch containing islands? It's possible to create regions from boundaries, SUBTRACT islands and call MASSPROP for centroid coordinates. So rude...

  • The centroid of a hach or lwpolyline cannot be found in the entity list (entget).

    Using center snap on a closed lwpolyline is totally inaccurate (SR 23174).

    If you want to use the centroid of a polyline you should follow the advice of Vaidas Guogis and create a region first.

  • Thanks for the help.

  • you can try getting the bounding box

     

    (defun c:chatch ( / ll ur)
      (vla-getboundingbox (vlax-ename->vla-object
        (car (entsel "\nget hatch: "))) 'll 'ur)
      (mapcar '* '(0.5 0.5 0.5)
        (mapcar '+ (vlax-safearray->list ll) (vlax-safearray->list ur) ))
    )
  • But the bounding box is not the centroid of the hatched area, except for simple geometric shapes without islands. I hadn't thought about it before, but the grip of a hatch does appear to be the true centroid of its area in all cases.
    Kenneth has raised a very interesting issue. The application routinely calculates a quite useful point and displays it, but gives the user no access to its numerical value.
    I can't think of any other case of a point that is displayed as a grip but can't be snapped to or read as a DXF code or in the properties bar.

  • I added a function to my lisp tools collection (BRX)  called  crpgetstretchpoints, usage
    (crpgetstretchpoints (car(entsel))) 
    This ought to get your grip point for the hatch.

    http://www.theswamp.org/index.php?topic=21875.0

    Note: it is possible to add a snap to a hatch via BRX, by adding an entry to the acdbCustomOsnapManager,  but my time is limited today as the wife feels like shopping for shoes..

This discussion has been closed.