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

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2367
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: 17467
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.   
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Andrea

  • Water Moccasin
  • Posts: 2367
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

  • Mesozoic relic
  • SuperMod
  • Swamp Rat
  • Posts: 1365
  • 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

Sometimes the question is more important than the answer.
#ridesober

MP

  • Seagull
  • Posts: 17467
Re: get PDF with DBX
« Reply #4 on: January 15, 2019, 05:23:21 PM »
TX
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

MP

  • Seagull
  • Posts: 17467
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.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

MP

  • Seagull
  • Posts: 17467
Re: get PDF with DBX
« Reply #6 on: January 16, 2019, 12:57:07 PM »
should work ...

Did a quick test; works. Cheers.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Lee Mac

  • Seagull
  • Posts: 12283
  • 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: 17467
Re: get PDF with DBX
« Reply #8 on: January 16, 2019, 04:53:23 PM »
Thanks Lee. :)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Andrea

  • Water Moccasin
  • Posts: 2367
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: 17467
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.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

ronjonp

  • Needs a day job
  • Posts: 7044
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 10 x64 - AutoCAD /C3D 2020

Custom Build PC

MP

  • Seagull
  • Posts: 17467
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.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox