How to get Page Number of a PDFunderlay element with Autolisp ?

How to get Page Number of a PDFunderlay element with Autolisp ?

Kh.mbkh
Advocate Advocate
536 Views
10 Replies
Message 1 of 11

How to get Page Number of a PDFunderlay element with Autolisp ?

Kh.mbkh
Advocate
Advocate

How to get Page Number of a PDFunderlay element with Autolisp ?, since this is the "key" variable to access a wanted PDFunderlay.

Thanks !

 

Khmbkh_0-1739220880585.png

 

0 Likes
Accepted solutions (3)
537 Views
10 Replies
Replies (10)
Message 2 of 11

paullimapa
Mentor
Mentor
Accepted solution
(getpropertyvalue (car(entsel)) "DefinitionId/ItemName")

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 11

paullimapa
Mentor
Mentor
Accepted solution

and another method:

(vla-get-itemname (vlax-ename->vla-object (car(entsel))))

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 11

ronjonp
Advisor
Advisor
Accepted solution

And another: 

(cdr (assoc 2 (entget (cdr (assoc 340 (entget (car (entsel))))))))
0 Likes
Message 5 of 11

Kh.mbkh
Advocate
Advocate

Thnaks @paullimapa @ronjonp .

 

Is there any documentation for PDFunderlay with Autolisp. (How to unload, detach ... ) 

0 Likes
Message 6 of 11

cadffm
Consultant
Consultant

The same like for other objects.

DXF Reference - Underlay / PDFunderlay

ActiveX ObjectModel - PdfUnderlay

nothing more

Or is there a documentation about "how to create a Line"? No.

Creation

DXF/AUTOLISP: ENTMAKE  -> PDFunderlay is not supported

ActiveX -> vla-addPdfUnderlay doesn't exist  -> PDFunderlay creation is not supported, as documented about the PdfUnderlay object.

Sebastian

0 Likes
Message 7 of 11

Kh.mbkh
Advocate
Advocate

Ok thanks @cadffm , so how to simply "unload" and "Reload" a PDFunderlay (as an entity got with (car (entsel))) with Autolisp ?

0 Likes
Message 8 of 11

cadffm
Consultant
Consultant

Hi,

 

since there are no explicit function to do that, also no native autocad command,

I would need to check all the data structure to understand, how it works.

 

I am not next to my  Autocad and my own codes and notes,

so I would need to search online for it 

but it's on you.

 

Start to check all around the pdfunderlay definition

 

(setq dictcoll (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))))
(vlax-for di dictcoll
(if
(eq (vl-catch-all-apply 'vla-get-name (list di)) "ACAD_PDFDEFINITIONS")

(Vlax-dump-object di)

)

 

Please check the code yourself, I am walking on a treadmill with a 6" device, isn t funny to read&write.

Sebastian

0 Likes
Message 9 of 11

paullimapa
Mentor
Mentor

I could be mistaken but I don't see a method to unload, reload or even detach a specific pdf using lisp.

This means we have to rely on the External References Palette to do this.

There's only a lisp function to delete all pdfs...see the following links for examples:

https://forums.augi.com/archive/index.php/t-131322.html

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-detach-all-pdfs/td-p/8852704...

https://www.cadtutor.net/forum/topic/71943-change-from-delete-to-remove-path-pdf/

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 11

Kh.mbkh
Advocate
Advocate

Yeah @paullimapa All we find is about detach the PDFunderlay (so delete it). I think we'll be obliged "again" to switch to .NET 😶

 

0 Likes
Message 11 of 11

paullimapa
Mentor
Mentor

here's a .NET version to unload all pdfs:

https://adndevblog.typepad.com/autocad/2016/07/unload-all-the-pdf-underlay.html


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos