Jump to content

Recommended Posts

Posted (edited)

Fixed it with a hammer method with this below. Which is probably not what a real programmer would do.

 

;; isPropMissing
;; Written by 3dwannab, 2023.07.07
;; Test your props, props to you

(defun isPropMissing (e p /) 
  (vl-catch-all-error-p 
    (vl-catch-all-apply 
      (function 
        (lambda () 
          (vlax-get-property e p)
        ) ;_ end of lambda
      ) ;_ end of function
    ) ;_ end of vl-catch-all-apply
  )
)

(setq e (car (entsel "Pick me, pick me!\n")))
(setq e (vlax-ename->vla-object e))

;; Doesn't seem to like the gradient properties of some hatches
;; So set up two different hatchPropLists

(setq hatchPropListsWithTrans '(associativehatch backgroundcolor elevation entitytransparency gradientangle gradientcentered gradientcolor1 gradientcolor2 gradientname hatchobjecttype hatchstyle isopenwidth layer linetype linetypescale lineweight material origin patternangle patterndouble patternscale patternspace plotstylename truecolor visible))
(setq hatchPropListsWithoutTrans '(associativehatch backgroundcolor elevation entitytransparency gradientangle hatchobjecttype hatchstyle isopenwidth layer linetype linetypescale lineweight material origin patternangle patterndouble patternscale patternspace plotstylename truecolor visible))

;; Based on whether there's transparency or not it gets a list of the hatches properties
(if (isPropMissing e "gradientcolour2") 
  (setq a (mapcar '(lambda (x) (list x (vlax-get e x))) hatchPropListsWithoutTrans))
  (setq a (mapcar '(lambda (x) (list x (vlax-get e x))) hatchPropListsWithTrans))
)

(princ a)
(princ "\n")
(princ "Prop Missing? ")
(princ (isPropMissing e " gradientcolour2 "))

(setq a nil)
(setq e nil)
(setq hatchPropListsWithoutTrans nil)
(setq hatchPropListsWithTrans nil)

 

Edited by 3dwannab

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...