Author Topic: get PDF with DBX  (Read 3648 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
get PDF with DBX
« on: January 15, 2019, 01:58:14 PM »
Hi all,...

I've this code to get PDF with ODBX method.

Code: [Select]
(vlax-for i (vla-get-Layouts dbx)
  (vlax-for Obj (vla-get-Block i)
    (if (and
  (not (member (vla-get-ObjectName obj) '("AcDbViewport")))
  (= (vla-get-ObjectName Obj) "AcDbPdfReference")
  (vlax-property-available-p Obj 'File)
  (setq pdffile (findfile (vla-get-File Obj)))
)
      (setq PdfList (append PdfList (list pdffile)))
    )
  )
)

it work,...but in some case,...it take very long to get the PDF list due the fact the..
Code: [Select]
(vla-get-count (vla-get-Block i)) = 19779
so I'm trying to found a workaround and accelerate the process...
any suggestion ?

Thank you.


Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #1 on: January 15, 2019, 03:58:25 PM »
doc
 >> dictionaries
     >> acad_pdfdefinitions
         >> entry
             >> cdr of second 330 group is the instance


And yes, you can get dxf data from dbx docs. Cheers.   
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: get PDF with DBX
« Reply #2 on: January 15, 2019, 04:43:23 PM »
Thank you guys,...

I'll give a try... :)
Keep smile...

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2120
  • class keyThumper<T>:ILazy<T>
Re: get PDF with DBX
« Reply #3 on: January 15, 2019, 05:00:08 PM »

very succinct MP.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #4 on: January 15, 2019, 05:23:21 PM »
TX
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #5 on: January 15, 2019, 09:11:18 PM »
Quick & dirty - should work but it's been a long day O.o ...

Code: [Select]
(defun _get-pdf-refs ( doc / temp )
    (mapcar 'vlax-ename->vla-object
        (apply 'append
            (mapcar
               '(lambda (x)
                    (mapcar 'cdr
                        (vl-remove-if-not
                           '(lambda (p)
                                (and
                                    (eq 330 (car p))
                                    (eq "PDFUNDERLAY" (cdr (assoc 0 (entget (cdr p)))))
                                )
                            )
                            (entget (vlax-vla-object->ename x))
                        )
                    )
                )
                (progn
                    (vl-catch-all-apply 'eval
                       '((vlax-for x
                            (vla-item (vla-get-dictionaries doc) "acad_pdfdefinitions")
                            (setq temp (cons x temp))
                        ))
                    )
                    (reverse temp)
                )
            )
        )
    )
)

FWIW ... cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #6 on: January 16, 2019, 12:57:07 PM »
should work ...

Did a quick test; works. Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: get PDF with DBX
« Reply #7 on: January 16, 2019, 01:25:11 PM »
Code: [Select]
                    (vl-catch-all-apply 'eval
                       '((vlax-for x
                            (vla-item (vla-get-dictionaries doc) "acad_pdfdefinitions")
                            (setq temp (cons x temp))
                        ))
                    )

Neat alternative to (vl-catch-all-apply '(lambda ( ) (vlax-for ... ))) - I like it  :-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #8 on: January 16, 2019, 04:53:23 PM »
Thanks Lee. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: get PDF with DBX
« Reply #9 on: January 18, 2019, 08:59:40 AM »
Hi Guys,..

Thanks for the info,...
I'm trying to make test with DBX,..but entget can't be used..
so I still stuck with vla-for each images..

the code actually work,..but i'm trying to improve the speed execution..
any suggestion will be appreciated.
Thank you. :)
Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #10 on: January 18, 2019, 10:36:24 AM »
entget can't be used

Explain; I've used entget on dbx docs successfully longer than I've been a member here.
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: get PDF with DBX
« Reply #11 on: January 18, 2019, 10:55:12 AM »
I think he's referring to this working for IMAGES too.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: get PDF with DBX
« Reply #12 on: January 18, 2019, 11:01:54 AM »
Images are just as easy but I'll refrain from posting anything until I understand where the goal posts are. Thanks Ron.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst