Author Topic: run a lisp in dwgs WITHOUT opening the dwgs?  (Read 19303 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #15 on: November 03, 2005, 01:43:39 PM »
Edited the code above for new functionality to print a list of drawings that were not changed.

whdjr

  • Guest
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #16 on: November 03, 2005, 02:02:52 PM »
The other option would be to just ignore the ones you can't open:

Code: [Select]
(if (not (vl-catch-all-error-p of))
      (progn
(LayerFiltersDelete dbxdoc)
(princ
  (strcat "\nDeleting Layer Filters in " f)
)
(vla-saveas dbxdoc f)
      )
    )

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #17 on: November 03, 2005, 03:20:51 PM »
I think it is already done that way Jeff.
So it is.....I didn't look at the code prior to posting, oops. However, you CAN open a read-only file without error.....it's when you save it that the error occurs. Hmmm, actually I don't get an error, just an alert box saying it can't be saved..... Should probably find a function to check if the file is RO and skip it if it is.....

T.Willey

  • Needs a day job
  • Posts: 5251
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #18 on: November 03, 2005, 03:27:54 PM »
Here is one I use.

Code: [Select]
(defun CheckOpen (FileName / test)
; Return T if not open.

(if (findfile FileName)
 (if (setq test (open FileName "a"))
  (progn
   (close test)
   T
  )
 )
)
)

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #19 on: November 03, 2005, 04:21:30 PM »
Why won't this purge work in the dbx?

Code: [Select]
(defun LayerFiltersDelete (doc)
  (vl-Catch-All-Apply
    '(lambda ()
       (vla-Remove
(vla-GetExtensionDictionary
   (vla-Get-Layers doc)
)
"ACAD_LAYERFILTERS"
       )
     )
  )
  (vl-Catch-All-Apply
    '(lambda ()
       (vla-Remove
(vla-GetExtensionDictionary
   (vla-Get-Layers doc)
)
"AcLyDictionary"
       )
     )
  )

       (vla-purgeall
(vla-get-activedocument
   (vlax-get-acad-object)
)
       )

)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #20 on: November 03, 2005, 04:51:33 PM »
Quote
(vla-purgeall
   (vla-get-activedocument
      (vlax-get-acad-object)
   )
       )

This is trying to purge the active document (drawing) instead of the one you open with ObjectDBX.  Maybe try
(vla-PurgeAll Doc)  since you use Doc as the argument.  It might not work with ObjectDBX, but I'm not sure.

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #21 on: November 03, 2005, 04:57:13 PM »
It might not work with ObjectDBX, but I'm not sure.

Tim

That's correct iirc, you have to analyze all the collections yourself and perform intelligent trapped deletes.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7526
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #22 on: November 03, 2005, 04:59:37 PM »
Just found on another forum:

Quote
Michael Puckett
Guest





   
[Post] Posted: Wed Jan 12, 2005 12:25 am    Post subject: Re: ObjectDbx : Xref Detach kaput    Reply with quote
Note to self: PurgeAll not available in ObjectDBX.


Hey! I know that guy! At least in cyberspace :).

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #23 on: November 03, 2005, 05:01:19 PM »
That guy is a flake.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #24 on: November 03, 2005, 05:05:01 PM »
Code: [Select]
(defun DeleteFromCollection (Collection / )
; Delete all objects in a collection that can be deleted.

(vlax-for i Collection
 (vl-catch-all-apply 'vla-Delete i)
)
)

I just posted this in another forum.

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #25 on: November 03, 2005, 05:09:03 PM »
That's correct iirc, you have to analyze all the collections yourself and perform intelligent trapped deletes.

Thanks for the clarification.

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Bob Wahr

  • Guest
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #26 on: November 03, 2005, 05:20:52 PM »
Code: [Select]
(defun DeleteFromCollection (Collection / )
; Delete all objects in a collection that can be deleted.

(vlax-for i Collection
 (vl-catch-all-apply 'vla-Delete i)
)
)

I just posted this in another forum.

Tim
I just posted this here. ;P

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #27 on: November 03, 2005, 05:56:01 PM »
I just posted this in another forum.
Tim
OK, I give up........how did you come up with the user name of CiphDRMRS from Tim Willey???? (or vice versa...)
Oh, and welcome to the swamp!

Bob Wahr

  • Guest
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #28 on: November 03, 2005, 06:01:11 PM »
Until I new it was Tim, I was thinking that he was the wife of a Dr. who specialized in treating syphilis, and who wasn't too sharp with spelling.  Now I'm going to guess that he is a member of an organization called Ciphilitic Drummers (as most drummers are and few can spell)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: run a lisp in dwgs WITHOUT opening the dwgs?
« Reply #29 on: November 03, 2005, 06:12:03 PM »
Okay.  My friends and I were starting a Hip-Hop group  :-), and my nick was Cipher Ciph for short, and the group name was D.R.E.A.M.E.R.S.  Back in the day you couldn't have a long screen name with aol, so I had to shorten it.  I haven't changed it ever since, but I think I might have to soon because my parents (whose account it is) is getting cable, and leaving aol.

Can you guess how old I am?  :lmao:

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.