Post by Herman Mayfarth on May 31, 2010 18:07:40 GMT -8
Simple demonstration:
;;;---------------------PS3D_Cope.lsp--------------------------------
;;; Purpose: Cope ProSteel Shapes
;;; Version: 0.7
;;; Date: 31 May 2010
;;; Author: Herman Mayfarth
;;; Copyright © 2010 by Herman Mayfarth. All rights reserved.
;;; Provided "as is" and without warranty, express or implied.
;;; Use at your own risk.
;;; To do:
;;; 1. Rule-based cope
;;; 2. Multiple selection for coped shapes
;;;-----------------------------------------------------------------
(vl-load-com)
(setq *ACAD* (vlax-get-acad-object) *THISDWG* (vla-get-activedocument *ACAD*))
(defun C:Cope ( /
support
to-cope
conn
linkdata
top-dy
bottom-dy
webdist
flgdist-top
flgdist-bot
out-top
out-bot
radius
pctype
fittype
)
(vla-startundomark *THISDWG*)
;; hard coded values for simple demonstration
(setq pctype 1
fittype 1
webdist 0.5
radius 0.5
flgdist-top 0.5
flgdist-bot 0.5
top-dy 1.0
bottom-dy 1.0
outside-top 12.0
outside-bot 12.0)
(setq support (vlax-ename->vla-object (car (entsel "\nPick Support Shape"))))
(setq to-cope (vlax-ename->vla-object (car (entsel "\nPick Shape to Cope"))))
(setq conn (vla-getinterfaceobject *ACAD* "PSCOMWRAPPER.Ks_ComCopeConnection"))
(setq linkdata (vla-getinterfaceobject *ACAD* "PSCOMWRAPPER.Ks_ComCopeLinkData"))
(vlax-invoke conn 'SetSupportObject support)
(vlax-invoke conn 'SetConnectionObject to-cope)
(vlax-put-property linkdata 'DistanceInsideTop top-dy)
(vlax-put-property linkdata 'DistanceInsideDown bottom-dy)
(vlax-put-property linkdata 'WebDistance webdist)
(vlax-put-property linkdata 'DistanceEdgeTop flgdist-top)
(vlax-put-property linkdata 'DistanceEdgeDown flgdist-bot)
(vlax-put-property linkdata 'DistanceOutsideTop outside-top)
(vlax-put-property linkdata 'DistanceOutsideDown outside-bot)
(vlax-put-property linkdata 'PolyCutType pctype)
(vlax-put-property linkdata 'ShapeFitType fittype)
(vlax-invoke conn 'SetConnectionData linkdata)
(vlax-invoke conn 'Create)
(vlax-release-object linkdata)
(vlax-release-object conn)
(vla-endundomark *THISDWG*)
(princ)
):C:Cope
;;load message
(princ "\nPS3D_Cope V0.7 © 2010 Herman Mayfarth.")
(princ)