Jump to content

Filter Device list


Small Fish

Recommended Posts

How would I filter my list so that only pc3 files and "none" show

ie without listing system printers?

thanks

 

 

 
(setq ad (vla-get-activedocument (vlax-get-acad-object)))
     (vla-RefreshPlotDeviceInfo (vla-get-activelayout ad))
     (setq Devicelist (vlax-safearray->list (vlax-variant-value 
     (vla-getplotdevicenames (vla-item (vla-get-layouts ad) Model")))))

Link to comment
Share on other sites

Just a simple vl-remove-if-not...

 

(defun GetPC3 ( / doc )
 (vl-load-com)

 (vla-RefreshPlotDeviceInfo
   (vla-get-ActiveLayout
     (setq doc
       (vla-get-activedocument
         (vlax-get-acad-object)
       )
     )
   )
 )
 (vl-remove-if-not
   (function
     (lambda ( x ) (or (eq "None" x) (wcmatch x "*.pc3")))
   )
   (vlax-invoke
     (vla-item (vla-get-layouts doc) "Model") 'GetPlotDeviceNames
   )
 )
)

Link to comment
Share on other sites

thanks Lee - Sweet .....thats what I was after.

"vl-remove-if-not" will be useful for other things I will use later

cheers

SF :thumbsup:

 

Chuck - I was aware of that - I just needed to know programmatically

Link to comment
Share on other sites

thanks Lee - Sweet .....thats what I was after.

"vl-remove-if-not" will be useful for other things I will use later

cheers

SF :thumbsup:

 

Chuck - I was aware of that - I just needed to know programmatically

Also keep in mind the useful vl-remove and vl-remove-if. :wink:

Link to comment
Share on other sites

Small Fish, the 'auto word complete' in the VLIDE is quite handy for discovering similar functions if you are new to LISP - for example, in a new file in the VLIDE,

 

Type vlax-curve- then press Ctrl+Shift+Space :wink:

Link to comment
Share on other sites

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...