I want to export my AutoCAD Layers filters to another drawing - vb.net

I work on drawings prepared by others. At the moment, I XREF the drawings into my own template and I have my Layers and Filters set to my preferences. However, I have to edit the XREF and create my own layers and filters within the other drawing - every time - twice a day. I want to export my filters to the drawing. I use AutoCAD 2014 and the option to export my filters to another drawing is not available. Apparantly, the option was available in earlier versions of AutoCAD but not mine. However, other Autodesk products do have this option (3DCivils, Architecture) so it is possible to export the layer filters.
I have tried to find a VBA method to do this but I have been unable to find the VBA property or method to read the filters. Moving the layers is easy, but not the filters. The forums say there is no method. Therefore, would it be possible to create an add-in that would manipulate the Layer Manager and create my Layer Filters. I would have a button that would run the macro.
I suspect I will have to write a .NET routine but is what I am trying to achieve 'do-able'.

This is definitely 'do-able'. Kean has a very clear article covering this topic. Once you read them you could either serialize them to a file (like XML) for export and have another routine just for populating new drawings or if you have both drawings open, just change the database the layers and filters need to be read/written to.

Related

Found an OfficeDraw file with shapes. Can the shapes be used without continuous copy-and-paste?

I downloaded an OpenOffice Draw document with shapes I want to use (for drawing Apache Camel diagrams). I'm not very familiar with Draw, but I've used Visio; in Visio, there was a kind of file in which you could find/put shapes, then use to create drawings from those shapes. The shapes appeared in a panel left of and smaller than the drawing, and you could drag a shape from that panel to the drawing to put an instance of that shape on your drawing; the original shape remained on the smaller panel.
I think Visio called the file that held the shapes you could use a "template"; Draw has templates, but I haven't found a reference to them holding shapes to drag onto a drawing. I've tried looking it up, but am hampered by not knowing what terms Draw uses for these things. Can someone tell me whether this is possible in Draw, and what things I should look up help on? I hate to read a whole manual to find out how to use one feature, without even knowing if the feature exists...
--
I'm sorry, I should have done better describing what I have tried. The file holding the shapes is an odg file; it opens fine as a document, and the program allows me to save it as a template, but the behavior of being a collection of shapes that I can drag onto a new drawing repeatedly, without having to copy a shape each time, is not there. That's the feature I'm trying to find.
My version (LO 5.2.3.3/openSuse) allows the creation of a new shape gallery theme (see: View>Clipart Gallery), and the addition of various graphic format files to that theme.
Also, in context meni of a shape, I can edit with external program.
So, I guess, you can save the shape(s) in a file and add it to My Shapes theme.
There will be two new files in ~/.config/libreoffice/5/user/gallery with the shape(s), to backup/restore (to a new installation) or distribution (to other computers).
Edit if your version of the office suite is lacking of that menu options, maybe you can extract the shapes from the *.odg file: unzip it and look for a custom *.sdv and *.thm file in the archive.

How to programmatically remove PDF layers?

I know about Doc.SetOCGOrder() and the likes, but apparently the Acrobat API does not provide means to remove layers (aka optional content groups, ocgs), only to hide them from users while leaving them accessible via scripting.
I'm not forced to use Acrobat, in fact I'd prefer a FOSS-solution (or at least freeware) using e.g. pypdf2 or pdftk. edit There is another post using abcpdf, which is unfortunately not free. Is there any way to port that behaviour to Acrobat's JS or pypdf2? Essentially the answer seems to loop through every page's content, which seems to include the layers.
(Concerning merging, I notice pdftk does remove layers when merging multiple files, so one can simple pdftk A=input.pdf B=input.pdf cat A1-end output output.pdf.)
My approach so far: For the relevant layers obtained via GetOCGs() set locked=true and both initState=false and state=false. Then use SetOCGOrder() to remove the layer from the layers view. Unfortunately this is not perfect, since at least in Acrobat DC I can still select "show all layers" in the layers panel, which still shows the layer. One could merge all layers now, but neither did I find an option to achieve that programmatically nor do I believe that would actually remove the hidden layer's elements.
You can't do it programmatically but you can create an Action that will process a folder full of PDF files using Adobe Acrobat. Set the Action to use the PDF Optimizer to discard hidden layers and flatten visible ones. See the graphic.

Placing a bitmap into a Powerpoint Add-In

All:
I am writing a PowerPoint add-in that will allow a user to drop specific safety related images onto a map. I've written the code that copies the images and places them on the slide and I would like to place it into an add-in. Unfortunately, I cannot find a way to either:
a) place the images into the add-in
b) reference images if I were able to place them in the add-in
The alternative approach is to require the user to start with a special template that includes all of the images and then load the add-in to get the menu functionality. I would much rather have a single file that contains both the code and bitmap images.
With best regards,
Walt
PPA files contain only code, not presentation content like images. As an alternative, you could distribute a PPT/PPTX that you open invisibly and extract the image you need.
After quite a bit of looking around I found a solution that resolves the problem adequately. Using Microsoft's Custom UI Editor, I created an XML entry in the PowerPoint Presentation that performs the Auto_Open function that would have been part of the Add-In. This allows me to add the menu functions that will be responsible for loading the specific images.
I've added a reference page at the beginning of the presentation that contains instructions on how to use the template... This page also contains all of the images that are used by the visual basic code. The 'Visible' flag on these images are set to False so the user does not see them. As they are copied from the reference page into the presentation, the Visible flag is set to True and they are pasted onto the current slide.
It is not a perfect solution, but it is adequate...

How to create switchable multi-language pdf form?

I want to create a pdf form for two language (Chinese/English) UI, and there's a button(s) or somethings on the form for language switch, is there anyway can make it? and how to do?
thanks!
Thanks for all reply!
Actually I got a sample like this,
PDF Sample
there're two checkbox on the top-left of the form, one is for English UI, the other is Chinese, I just want to know how to make PDF like that sample? (and I don't see any layers on the sample...)
thx
mkl's comment (which he should turn into a full answer, really) already hinted at the option to use different page templates residing in the same file.
Another option you could explore is this:
put the two language versions into 2 different layers (or 'optional content groups' in PDF parlance)
make the visibility of the two layers toggeable
let the user activate that layer which he/she needs.
Layer activation can be handled through normal Acrobat Reader user interface elements.
The layer switching can be made accessible via a "button" on the PDF page too -- but that requires additional JavaScript to be embedded in the PDF (something many people are not particularly keen about).
As Kurt proposed, I make my comment on Frank's answer an answer in its own right:
Actually there is a pdf feature seldomly used nowerdays, page
templates. Thus, those two forms can reside in the same file in
different page templates, and based on some initially present buttons
("English version", ...) the desired form is spawned.
Unfortunately I don't know how to create page templates using some easy-to-use tool, I only came a cross them in the context of integrated PDF signatures (depending on the signature type, page template instantiation is a document change not breaking the signature) and tested them with low-level tools.
Essentially page templates are PDF objects just like page dictionaries of the normal pages, they are not XFA stuff. They merely are not referenced in the pages tree but instead in the name tree.
There is a JavaScript command which creates a visible page based on such a template --- I don't know which anymore; I may be able to find out when I'm back in office next week. This command would have to be bound to the inital language selection button in the file.
The problem will be in switching the static text - PDF does not allow this.
If I were you, I would split the document into two identical forms in the respective languages. You can use bookmarks and links on the first page to navigate to the right part of the document.
Note that it is possible to assign the same field names to the Enlgish/Chinese versions of your fields. This will make it easier to process the submitted form data because the process path would be independent of the chosen language. It will also simplify any JavaScript (validation, summing, etc.) you plan to add.

Is it possible to reference a photoshop file or layer comp from within another photoshop file?

Creating all the art for a large website often involves a couple dozen 50+mb photoshop files. Frequently, a given module may appear in more than one file.
Is there a way to reference an oft-used module from another file?
For instance -
"site-section-2.psd" references "common-module-h.psd", and "site-section-6.psd" also references "common-module-h.psd", so that any time updates are made to "common-module-h.psd", the updates appear in both files which reference it.
Possible?
(maybe with photoshop javascript?)
I've checked the JSX Photoshop Object Model, and you can access LayerComps, but there is no magic function to save from one file to another. Something like this could be written to disk, from file1.psd for example, then loaded into file2.psd.
It's a bit of a long shot and I don't know if it's worth the trouble.
For web prototyping I use Fireworks and and I'm pretty happy. You can easily create symbols (much like in Flash and Illustrator) and even save them to a Common Library, which means it will be easy peasy to keep your navigation items for example up to date, for all the files using it. You can even import PSD files into Fireworks, only not all the filters will be supported.
Don't know if you can keep most of the eye-candy in Photoshop and then assemble reamble versions with ease using Fireworks.
You can try converting all the layers into one smart object and then drag the smart object layer into the new .psd file.
Go to the Layers palette: Window > Layers(F7).
LMB SINGLE CLICK the top layer.
Scroll down Layer palette until you get to the bottom.
SHIFT + LMB SINGLE CLICK. At this point all the layers should be hilighted.
RMB SINGLE CLICK any of Layer "Titles".
You should see a menu pop up so use the mouse to scroll until you find "Convert to Smart Object". LMB SINGLE CLICK to convert all the layers into one smart object. The smart object can be edited by double clicking it in the Layers palette. You can also drag a smart object from one .PSD into another .PSD. I usually just open both .PSD files and drag the smart object form one Layers palette to the other Layers palette.