Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

custom field for 3D PDF exporting

15 REPLIES 15
Reply
Message 1 of 16
azad.akbari
846 Views, 15 Replies

custom field for 3D PDF exporting

I need to customize a 3d PDF and there are some fields that I can not export information from. The information is taken from the Iproperties.

 

These two works and I get the information out correctly:

{{{ topComponent['Part Number'] || "" }}}

{{{ topComponent.Title || "" }}}

 

However, this three fields becomes empty:

{{{ topComponent['Creation Date'] || "" }}}

{{{ topComponent['Checked Date'] || "" }}}

{{{ topComponent['Design State'] || "" }}}

 

I tried to change the code to following, but the result remains empty.

{{{ topComponent.Creation Date || "" }}}

{{{ topComponent.Checked Date || "" }}}

{{{ topComponent.Design State || "" }}}

 

15 REPLIES 15
Message 2 of 16
WCrihfield
in reply to: azad.akbari

Hi @azad.akbari.  What coding language are you using?  What does "topComponent" represent?  Have you reviewed the API Samble (which is in VBA, C#, & C++)?  In that example, they set the "ExportAllProperties" option to False.  Then create an Array of Strings, and fill it with String type specifications (only one in that example) with what specific iProperties to include.  Then they supply that Array of Strings as the value of the "ExportProperties" option.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 16
azad.akbari
in reply to: WCrihfield

Hi,

I use the Adobe reader language. Not sure which format it is built in.

Do you know what I should write instead of:

{{{ topComponent['Creation Date'] || "" }}}

{{{ topComponent['Checked Date'] || "" }}}

{{{ topComponent['Design State'] || "" }}}

 

Or maybe you have time for a meeting today so I can show how it looks?

 

Message 4 of 16
WCrihfield
in reply to: azad.akbari

Hi @azad.akbari.  I am not familiar with the Adobe reader language, and I do not recognize the formatting used in those lines of code.  I am not a software developer, just someone who is good with CNC related coding, VBA coding, and some vb.net coding (used in iLogic rules).  Hopefully one of the others here on this forum will review this post and be able to help you better than I could.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 16
azad.akbari
in reply to: WCrihfield

Hi,

Okey, then I will wait for a SW developer.

Message 6 of 16
Frederick_Law
in reply to: azad.akbari

I believe OP is editing 3D PDF template in Adobe.

It's JAVA Script, I think.

 

Some iProperties use different name in program.

Try this:

 

{{{ topComponent['Creation Time'] || "" }}}
{{{ topComponent['Date Checked'] || "" }}}
{{{ topComponent['Design Status'] || "" }}}

 

 

Here is a drawing iProperies list created with iLogic:

 

INFO|+Summary Information
INFO|-Inventor Summary Information
INFO| +Title
INFO| -Title
INFO| +Subject
INFO| -Subject
INFO| +Author
INFO| -Author
INFO| +Keywords
INFO| -Keywords
INFO| +Comments
INFO| -Comments
INFO| +Last Saved By
INFO| -Last Saved By
INFO| +Revision Number
INFO| -Revision Number
INFO| +Thumbnail
INFO| -Thumbnail
INFO|+Document Summary Information
INFO|-Inventor Document Summary Information
INFO| +Category
INFO| -Category
INFO| +Manager
INFO| -Manager
INFO| +Company
INFO| -Company
INFO|+Design Tracking Properties
INFO|-Design Tracking Properties
INFO| +Creation Date
INFO| -Creation Time
INFO| +Part Number
INFO| -Part Number
INFO| +Project
INFO| -Project
INFO| +Cost Center
INFO| -Cost Center
INFO| +Checked By
INFO| -Checked By
INFO| +Checked Date
INFO| -Date Checked
INFO| +Eng. Approved By
INFO| -Engr Approved By
INFO| +Eng. Approved Date
INFO| -Engr Date Approved
INFO| +Status
INFO| -User Status
INFO| +Material
INFO| -Material
INFO| +Part Revision
INFO| -Part Property Revision Id
INFO| +Web Link
INFO| -Catalog Web Link
INFO| +Part Icon
INFO| -Part Icon
INFO| +Description
INFO| -Description
INFO| +Vendor
INFO| -Vendor
INFO| +Part Type
INFO| -Document SubType
INFO| +Part Type name
INFO| -Document SubType Name
INFO| +Date proxy refreshed
INFO| -Proxy Refresh Date
INFO| +Mfg. Approved By
INFO| -Mfg Approved By
INFO| +Mfg. Approved Date
INFO| -Mfg Date Approved
INFO| +Estimated Cost
INFO| -Cost
INFO| +Standard
INFO| -Standard
INFO| +Design State
INFO| -Design Status
INFO| +Designer
INFO| -Designer
INFO| +Engineer
INFO| -Engineer
INFO| +Authority
INFO| -Authority
INFO| +Parameterized Template
INFO| -Parameterized Template
INFO| +Template Row
INFO| -Template Row
INFO| +External Part Revision
INFO| -External Property Revision Id
INFO| +Standard Revision
INFO| -Standard Revision
INFO| +Manufacturer
INFO| -Manufacturer
INFO| +Standards Organization
INFO| -Standards Organization
INFO| +Language
INFO| -Language
INFO| +Defer Updates
INFO| -Defer Updates
INFO| +Size Designation
INFO| -Size Designation
INFO| +Categories
INFO| -Categories
INFO| +Stock Number
INFO| -Stock Number
INFO| +Weld Material
INFO| -Weld Material
INFO| +Mass
INFO| -Mass
INFO| +Area
INFO| -SurfaceArea
INFO| +Volume
INFO| -Volume
INFO| +Density
INFO| -Density
INFO| +Valid MassProps
INFO| -Valid MassProps
INFO| +Flat Pattern Extents Width
INFO| -Flat Pattern Width
INFO| +FlatPatternExtentsLength
INFO| -Flat Pattern Length
INFO| +Flat PatternExtents Area
INFO| -Flat Pattern Area
INFO| +SheetMetalRule
INFO| -Sheet Metal Rule
INFO| +Last Update with
INFO| -Last Updated With
INFO| +Sheet Metal Width
INFO| -Sheet Metal Width
INFO| +Sheet Metal Length
INFO| -Sheet Metal Length
INFO| +Sheet Metal Area
INFO| -Sheet Metal Area
INFO| +Material Identifier
INFO| -Material Identifier
INFO| +Appearance
INFO| -Appearance
INFO| +Flat Pattern Defer Update
INFO| -Flat Pattern Defer Update
INFO|+User Defined Properties
INFO|-Inventor User Defined Properties
INFO| +Finish
INFO| -Finish
INFO| +Etch
INFO| -Etch
INFO| +Hardness
INFO| -Hardness
INFO| +Quantity
INFO| -Quantity
INFO| +Thickness
INFO| -Thickness
INFO|+Piping Style
INFO|-Piping Style
INFO| +Name
INFO| -Name
INFO| +ActiveState
INFO| -ActiveState
INFO| +PipeType
INFO| -PipeType
INFO| +RoutePreview
INFO| -RoutePreview
INFO| +Material
INFO| -Material
INFO| +Standard
INFO| -Standard
INFO| +FittingMaterial
INFO| -FittingMaterial
INFO| +FittingStandard
INFO| -FittingStandard
INFO| +RouteDirection90
INFO| -RouteDirection90
INFO| +RouteDirection45
INFO| -RouteDirection45
INFO| +DiameterType
INFO| -DiameterType
INFO| +Diameter
INFO| -Diameter
INFO| +Schedule
INFO| -Schedule
INFO| +OD
INFO| -OD
INFO| +ID
INFO| -ID
INFO| +Ending
INFO| -Ending
INFO| +IntermediateSegmentsMin
INFO| -IntermediateSegmentsMin
INFO| +IntermediateSegmentsMax
INFO| -IntermediateSegmentsMax
INFO| +IntermediateSegmentsInc
INFO| -IntermediateSegmentsInc
INFO| +TerminationSegmentsMin
INFO| -TerminationSegmentsMin
INFO| +TerminationSegmentsMax
INFO| -TerminationSegmentsMax
INFO| +TerminationSegmentsInc
INFO| -TerminationSegmentsInc
INFO| +RoundUpValue
INFO| -RoundUpValue
INFO| +DefaultBendRadius
INFO| -DefaultBendRadius
INFO| +BendRadius
INFO| -BendRadius
INFO| +SolidRoutePreviewColor
INFO| -SolidRoutePreviewColor
INFO| +PipingComponentColor
INFO| -PipingComponentColor
INFO| +PipeKey
INFO| -PipeKey
INFO| +CouplingKey
INFO| -CouplingKey
INFO| +StartFittingKey
INFO| -StartFittingKey
INFO| +EndFittingKey
INFO| -EndFittingKey
INFO| +Elbow90Key
INFO| -Elbow90Key
INFO| +Elbow45Key
INFO| -Elbow45Key
INFO| +SuppressStartFitting
INFO| -SuppressStartFitting
INFO| +SuppressEndFitting
INFO| -SuppressEndFitting
INFO| +UseSubASM
INFO| -UseSubASM

 

 

Message 7 of 16
azad.akbari
in reply to: azad.akbari

Thanks.

 

For creation date and checked date - I did get the value 2023-03-28 00:00:00.

How do I remove the time 00:00:00?

 

For State, I got the Value 1, 2 or 3.
1 should be WorkInProgress, 2 should be Pending and 3 should be Released.

How to I change so that the value names should be written instead of numbers?

 

Also, I have one column for weight. {{{ topComponent.Mass || "" }}}

It writes a lot of numbers after decimal. Is it possible to change it so that no decimals are written?

Message 8 of 16
azad.akbari
in reply to: azad.akbari

Please open this case - the problem isnt solved yet.


Additionally I would like to allow more numbers in the assembly 3d PDF.

Message 9 of 16
MjDeck
in reply to: azad.akbari

@azad.akbari , can you provide more details about this requirement:

Additionally I would like to allow more numbers in the assembly 3d PDF.


Mike Deck
Software Developer
Autodesk, Inc.

Message 10 of 16
azad.akbari
in reply to: azad.akbari

The most important task is the first one:

1. When I edit the PDF template from Autodesk for 3d documents I cant get all the digits. There isnt enough room in the assembly template. I dont know if the problem is the PDF template from autodesk or if it is the Inventor.

 

2. When having the PDF printed for 3d models for creation date and checked date - I did get the value 2023-03-28 00:00:00. I dont want the time though. How do I remove the time 00:00:00?

 

For State, I got the Value 1, 2 or 3.
1 should be WorkInProgress, 2 should be Pending and 3 should be Released.

How to I change so that the value names should be written instead of numbers?

 

Also, I have one column for weight. {{{ topComponent.Mass || "" }}}

It writes a lot of numbers after decimal. Is it possible to change it so that no decimals are written?

 

Did it help? If not, please tell me what part was not detailed enough.

 

Message 11 of 16
MjDeck
in reply to: azad.akbari

Here's a forum thread that might be useful. It has a link to PDF's that contain some details.
I'm still looking for answers to your specific questions.


Mike Deck
Software Developer
Autodesk, Inc.

Message 12 of 16
MjDeck
in reply to: azad.akbari

Here's code to remove the decimal places from the mass. It will also add a 'g' (meaning grams).

{{{(topComponent['Mass'].toFixed() + ' g') || "" }}}


The following will convert the Design Status to text:

{{{(topComponent['Design Status'] == 2 ? 'Pending' : (topComponent['Design Status'] == 3 ? 'Released' : 'Work In Progress'))}}}


The following can be used to remove the time from a date property. It does it by removing the blank (specified by \s) between the date and time, and everything after the blank.

{{{ topComponent['Date Checked'].replace(/\s.*/g, '') }}}

Mike Deck
Software Developer
Autodesk, Inc.

Message 13 of 16
azad.akbari
in reply to: azad.akbari

Thank you for the solutions.

The last problem I have is with the length of the partnumbers in the assembly bill of material. Please check attached picture bellow. I want the part number row to allow at 12 characters.

 

BR Azad

bill_of_material.PNG

Message 14 of 16
MjDeck
in reply to: azad.akbari

To change the part number width, you have to edit the JavaScript in the template file. Here are steps:

  • install Notepad++ from https://notepad-plus-plus.org/
  • in Adobe Acrobat, look at the All Tools list
  • at the bottom of the list, click "View more"
  • near the bottom, click on "Use JavaScript"
  • click on "Document javascript strings"
  • click on AnarkCoreScript and click Edit
  • that should bring up Notepad++
  • in the JavaScript, search for Part Number
  • a few lines below the line with Part Number, you should see:

 

rowText = this.rpad(pn, 9) + "  " + this.rpad(desc, 20) + " " + this.lpad(quantity, 4);

 

  • Change the 9 to 12 or greater.
  • save the file, and close Notepad++
  • close the Document JavaScripts dialog in Acrobat

That will fix the column width in the data, but you have to edit the table header separately. It's not in the JavaScript.
Use the "Prepare a form" tool and edit the Properties of the Part Number text field in the header.


There's some more info and background in this thread.


Mike Deck
Software Developer
Autodesk, Inc.

Message 15 of 16
vijayananths
in reply to: MjDeck

Hi, thanks for the codes. In the code for "Mass" you gave it is in "grams", can you suggest how to convert the value into "kg" please.

Message 16 of 16
vijayananths
in reply to: vijayananths

I tried this following, and it worked. 

 

{{{(topComponent['Mass'].toFixed()/1000 + ' kg') || "" }}}

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report