Jump to content

Is there a condition statement to find out if Xclip was used?


tiffanysml

Recommended Posts

Hi I have a bunch of drawings where some contain an xref that was xclipped and others did not. I want to run a command on the files that use the xclip to generate the xclip frame polyline

 

So to the effect of:

(if (**xclip is used**)

(command "xclip" "all" "" "p")

)

 

Is there a way to write a conditional statement to prove xclip is used/active in the dwg? Does using xclip leave any sort of marker on the dwg file?

 

Thank you!

Link to comment
Share on other sites

Using some code I already had written:

 

(defun HasXClip ( / a b c d e f )
   (and
       (while (setq a (tblnext "BLOCK" (null a)))
           (if (= 4 (logand 4 (cdr (assoc 70 a))))
               (setq b (cons "," (cons (cdr (assoc 2 a)) b)))
               b
           )
       )
       (setq c (ssget "_X" (list '(0 . "INSERT") (cons 2 (apply 'strcat (cdr b))))))
       (setq d -1)
       (progn
           (while (and (not f) (setq e (ssname c (setq d (1+ d)))))
               (setq f (LM:XClipBoundary e))
           )
           f
       )
   )
)              

(defun LM:XClipBoundary ( ename / xdict )
   (if
       (setq xdict (cdr (assoc 360 (entget ename))))
       (LM:XClipBoundary xdict)
       (if
           (and
               (eq "SPATIAL_FILTER" (cdr (assoc 0 (setq ename (entget ename)))))
               (eq 1 (cdr (assoc 71 ename)))
           )
           (   (lambda ( massoc ) (massoc 10 ename))
               (lambda ( key elist / item )
                   (if (setq item (assoc key elist))
                       (cons (cdr item) (massoc key (cdr (member item elist))))
                   )
               )
           )
       )
   )
)

 

Call with:

 

(HasXClip)

 

Will return T if drawing contains an XRef with an XClip.

 

Hence in your IF statement:

 

(if (HasXClip)
...
)

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