Assembly Drawing title block material N/A

andrew_canfield
Collaborator
Collaborator

Assembly Drawing title block material N/A

andrew_canfield
Collaborator
Collaborator

 

If a drawing template is used for a part the title block picks up the iproperty of the model's material.

 

The same drawing template is also  used for assemblies. Now the wish is for the title block to show "N/A" for material

 

How can the Properties - Model / Material iproperty be set to "N/A" when an assembly view has been placed?

 

Thanks for looking

 

Andrew

0 Likes
Reply
Accepted solutions (1)
2,973 Views
17 Replies
Replies (17)

Anonymous
Not applicable

Hi @andrew_canfield

 

I just wrote this few lines of code for you.

Only paste it into an iLogic rule to make it work.

 

Dim oDrawDoc As DrawingDocument
	oDrawDoc = ThisApplication.ActiveDocument
    
Dim oSheet As Sheet
	oSheet = oDrawDoc.ActiveSheet
    
Dim oView As DrawingView
    
For Each oView In oSheet.DrawingViews
    If oView.ReferencedDocumentDescriptor.ReferencedDocumentType = kAssemblyDocumentObject Then
        MessageBox.Show("Is an assembly")
    Else
        MessageBox.Show("Is not an assembly")
    End If
Next

It will check your drawing for views of .iam-files. Change the two MessageBox-lines to what you expect to happen in that specific case and trigger the rule with the open document event or whatever you like to .

 

I hope this will help you!

 

If you have further questions, please ask Smiley Wink

0 Likes

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @andrew_canfield,

 

Can you please provide sample drawings which are linked part and assembly respectively?

 

Please make sure that files are non confidential one.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes

andrew_canfield
Collaborator
Collaborator

Hello Chandra

 

The mapping is pretty simple, the template is used for parts and assemblies.

 

No problem for parts, but the template iproperty <material> is looking for a part - can it be swapped when an assembly is placed (or is there an alternative workflow- have two separate templates?)

 

Material4.JPG

 

 

The idea is for N/A to be displayed when an assembly is placed.

 

 

Regards

 

Andrew

0 Likes

dgreatice
Collaborator
Collaborator

Hi,

 

do you want to try hard way or easy way?

 

hard way with code, easy way with difference TitleBlocks (not difference template, just difference title block with easy naming for easy use).

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes

dgreatice
Collaborator
Collaborator

sorry, my clarification are if you edit that title block with hard way, if in 1 file there are many sheet, each sheet have difference base model (assemblys or parts), it cant be only use 1 titleblock, because that titleblock use for all sheet.

 

better way is create new titleblock for difference base model.

 

like A0 for Assy and A0 for part, then create sheet format for easy use when new sheet.

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes

andrew_canfield
Collaborator
Collaborator

My initial thought was a line of iLogic code.

thinking, If this, then replace.

But the part material doesn't exist so there's nothing to replace.

It's trickier than I thought.

 

 

0 Likes

dgreatice
Collaborator
Collaborator

are in 1 file there are many sheet and with difference base model? if yes you cant edit or replace that title block attribute.

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes

andrew_canfield
Collaborator
Collaborator

This idea doesn't seem right but..

 

 

if the drawing contains an assembly

then..

 

Place the text "N/A" (need to format the size & font)

at co-ordinates to suit the paper size/title block.

 

Else..do nothing

 

I think I could do most of that!- not sure how to ensure the font is Arial 5mm.

0 Likes

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @andrew_canfield,

 

 

In any assembly file, Material iProperty is disabled. For more details, refer the following screenshot.

 

Assy_iProperties.png

 

It is clear that, "Material" iProperty is unable for Assembly files.

 

But it is available for part files. refer the following screenshot of iProperty in part file.

 

Part_iProperties.png

 

That's why, In drawing file "Material" iProperty is able to link from part file.

 

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes

andrew_canfield
Collaborator
Collaborator

Completely different approach! 

Place "N/A" in the empty text box - just add it to the drawing:

 

still need to figure out how to set the font height

 

added this 

 #Dim oStyle As TextStyle
   # oStyle = oGeneralNotes.Item(1).TextStyle
    #oStyle.FontSize * 3

which doesn't work!! 

 

Making progress 🙂

 

 

 

    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
   oDrawDoc = ThisApplication.ActiveDocument

    ' Set a reference to the active sheet.
    Dim oActiveSheet As Sheet
  oActiveSheet = oDrawDoc.ActiveSheet
    
    ' Set a reference to the GeneralNotes object
    Dim oGeneralNotes As GeneralNotes
    oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes
    
    Dim oTG As TransientGeometry
   oTG = ThisApplication.TransientGeometry
   
   
 #Dim oStyle As TextStyle
   # oStyle = oGeneralNotes.Item(1).TextStyle
    #oStyle.FontSize * 3

    ' Create text with simple string as input. Since this doesn't use
    ' any text overrides, it will default to the active text style.
    Dim sText As String
	
    sText = "N/A"
    
    Dim oGeneralNote As GeneralNote
   oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(92.3, 1.2), sText)
0 Likes

andrew_canfield
Collaborator
Collaborator

It's a complete fudge but ...

    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
   oDrawDoc = ThisApplication.ActiveDocument

    ' Set a reference to the active sheet.
    Dim oActiveSheet As Sheet
  oActiveSheet = oDrawDoc.ActiveSheet
    
    ' Set a reference to the GeneralNotes object
    Dim oGeneralNotes As GeneralNotes
    oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes
    
    Dim oTG As TransientGeometry
   oTG = ThisApplication.TransientGeometry 

    ' Create text with simple string as input. Since this doesn't use
    ' any text overrides, it will default to the active text style.
    Dim sText As String
'	
    sText = "N/A"
'    
'    Dim oGeneralNote As GeneralNote
'   oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(92.3, 1.2), sText)

If ActiveSheet.Size= "A0" Then 
	tx=92.64
	ty= 1.37  

	
	   Else If ActiveSheet.Size= "A1"
   	tx=57.8
	ty= 1.37
	
	   Else If ActiveSheet.Size= "A2"
   	tx=33.2
	ty= 1.37
	
   
   
   
   
   
   End If
   
'   tx=92.64
'   ty= 1.37 
   
oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(tx, ty), sText)
oGeneralNote.FormattedText = "<StyleOverride FontSize = '0.25'>" & sText & "</StyleOverride>"
0 Likes

bradeneuropeArthur
Mentor
Mentor

Hi,

 

This can be done without coding:

  1. Create an custom I-property ie CompanyMaterial with the Expression "<N/A>" in the assembly templates. no = symbol
  2. Create an custom I-property ie CompanyMaterial with the Expression "=<Material>" in the part templates. with = symbol
    The material will be prompted in this property too.
  3. Go to the drawing  template and create an custom I-property ie CompanyMaterial.
  4. put one of the parts or assembly templates into your dwg template
  5. go tho the drawingdocument settings options and copy the iprop CompanyMaterial. to the drawing
  6. delete the parts or assembly from your drawing and save as template again.
  7. put a textbox or symbol in your drawing with the CompanyMaterial
  8. the assembly dwg will show <N/A>
  9. the part dwg will show the material

 Iprop copy2 dwg.PNG

 

 

if help needed please let me know

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

andrew_canfield
Collaborator
Collaborator

Thanks, I think I follow..

could I have a screen shot of:

 

  1. Create an custom I-property ie CompanyMaterial with the Expression "<N/A>" in the assembly templates. no = symbol
  2. Create an custom I-property ie CompanyMaterial with the Expression "=<Material>" in the part templates. with = symbol

 

I'm thinking the drawing take the iproperty from the .iam template?

 

The iam template takes the iproperty from a part (custom property n/a)

 

When the parts are deleted aren't the links lost? 

 

Ongoing...

0 Likes

bradeneuropeArthur
Mentor
Mentor

what screenshot do you need.

 

the links are not links in terms of links.

 

so they are deleted after part or assembly removal.

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bradeneuropeArthur
Mentor
Mentor
Accepted solution

ScreenShot part:

 

CompanyMaterial Part.PNG

 

Screenshot Assembly:

 

CompanyMaterial Ass.PNG

The Assembly uses fix text as <N/A> for Companymaterial

the part used =<material> for Companymaterial

 

Then copy the property "Companymaterial" into the drawing via the document settings:

Screenshot is in previous post.

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

andrew_canfield
Collaborator
Collaborator

One slight hitch. 

 

90% of the assemblies have been created, the fix is to add the new CompanyMaterial N/A iproperty  (I think)

 

Regards

 

Andrew

0 Likes

bradeneuropeArthur
Mentor
Mentor
Or put a default value in your drawing property n/a

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes