Overall selected entities measurement in X & Y and distance snap.

I am trying out the trial of V12 with a view to changing my CAD software and have a couple of questions.

Is it possible to select multiple entities on different layers and get an overall size in X & Y?

Also my existing 2D CAD software has a snap facility that will select a distance along an entity, i.e. draw a line starting 20mm along an arc depending on which end of the arc you select.

If you select a negative value it will be on the same geometry of the line or arc but off the end of the entity.

Are there either of these facilities in Bricscad?

Many thanks,

David

Comments

  • To my knowledge both features are not part of BC. They are however programmable in Lisp.

    A Lisp for Feature #1:

    (defun kg:Pickset->EnameList (ss / i result)
    (if ss
    (repeat (setq i (sslength ss))
    (setq result (cons (ssname ss (setq i (1- i))) result))
    )
    )
    )

    (defun c:SetToBox ( / ss ptMinList ptMaxList)
    (if (setq ss (ssget))
    (progn
    (setq ss (mapcar 'vlax-ename->vla-object (kg:Pickset->EnameList ss)))
    (mapcar
    '(lambda (obj / ptMin ptMax)
    (vla-getboundingbox obj 'ptMin 'ptMax)
    (setq ptMinList (cons (vlax-safearray->list ptMin) ptMinList))
    (setq ptMaxList (cons (vlax-safearray->list ptMax) ptMaxList))
    )
    ss
    )
    (mapcar 'vlax-release-object ss)
    (list
    (list
    (apply 'min (mapcar 'car ptMinList))
    (apply 'min (mapcar 'cadr ptMinList))
    (apply 'min (mapcar 'caddr ptMinList))
    )
    (list
    (apply 'max (mapcar 'car ptMaxList))
    (apply 'max (mapcar 'cadr ptMaxList))
    (apply 'max (mapcar 'caddr ptMaxList))
    )
    )
    )
    )
    )

    A Lisp for Feature #2 is a bit harder. I'll try to look into it in the coming weeks.

    Let me know if you need any instruction regarding the use of Lisp file.

  • Roy,

    Thanks for sending this through, I think I loaded the file properly.

    Unfortunately I must have done something wrong or I am being a bit thick as the numbers in the command line don't make any sense to me.

    My overall size is 683mm x 488mm

    The command line shows ((153.212 78.788 0.0) (835.955 566.631 0.0))

    Can I post .jpg images on this forum, it would be easier to show you than try to explain?

    Many Thanks

    David

     



  • The SetToBox function in my previous post returns the min. and max. points of the selection.

    Below is a new version of the lisp:
    - SetToBox has improved output.
    - There is a new command SetToSize which returns the overall size of the selection.

    (defun kg:Pickset->EnameList (ss / i result)
    (if ss
    (repeat (setq i (sslength ss))
    (setq result (cons (ssname ss (setq i (1- i))) result))
    )
    )
    )

    (defun kg:Pickset->Box (ss / ptMinList ptMaxList)
    (setq ss (mapcar 'vlax-ename->vla-object (kg:Pickset->EnameList ss)))
    (mapcar
    '(lambda (obj / ptMin ptMax)
    (vla-getboundingbox obj 'ptMin 'ptMax)
    (setq ptMinList (cons (vlax-safearray->list ptMin) ptMinList))
    (setq ptMaxList (cons (vlax-safearray->list ptMax) ptMaxList))
    )
    ss
    )
    (mapcar 'vlax-release-object ss)
    (list
    (list
    (apply 'min (mapcar 'car ptMinList))
    (apply 'min (mapcar 'cadr ptMinList))
    (apply 'min (mapcar 'caddr ptMinList))
    )
    (list
    (apply 'max (mapcar 'car ptMaxList))
    (apply 'max (mapcar 'cadr ptMaxList))
    (apply 'max (mapcar 'caddr ptMaxList))
    )
    )
    )

    (defun c:SetToBox ( / ss)
    (if (setq ss (ssget))
    (mapcar
    '(lambda (str pt)
    (princ
    (apply
    'strcat
    (cons
    str
    (mapcar
    'strcat
    '("X=" ", Y=" ", Z=")
    (mapcar 'rtos pt)
    )
    )
    )
    )
    )
    '("\nMin. point of selection: " "\nMax. point of selection: ")
    (kg:Pickset->Box ss)
    )
    )
    (princ)
    )

    (defun c:SetToSize ( / ss)
    (if (setq ss (ssget))
    (princ
    (apply
    'strcat
    (mapcar
    'strcat
    '("\nOverall size of selection: X size=" ", Y size=" ", Z size=")
    (mapcar 'rtos (apply 'mapcar (cons '- (reverse (kg:Pickset->Box ss)))))
    )
    )
    )
    )
    (princ)
    )

    (princ "\nAvailable commands: SetToBox and SetToSize ")
    (princ)
  • Roy,

    Thank you very much for this, I am very impressed with the help you get on this forum.

    Your revised file works perfectly.

    If I can get my head around the 2D constraints feature and they do what I need this could be the software for me.

    Once again thanks for the help.

    All the best,

    David

  • @ David:
    I have added the second feature you have requested to my BKG_AdditionalSnaps:
    http://www.b-k-g.nl/BKG_AdditionalSnaps.html
    (freeware)

This discussion has been closed.