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: 

Drawing View won't update

6 REPLIES 6
Reply
Message 1 of 7
gerrard.hickson
1350 Views, 6 Replies

Drawing View won't update

Hi all,

 

I've got a macro which is creating .ipt and .idw files from templates. I'm once created I'm replacing the reference in the .idw to refer to the newly created .ipt file. The problem is that the drawing view isn't updating... I've been googling like mad, and i've tried the suggestions I've found, that is make the .ipt file dirty then udpate the drawing, but that hasn't worked. I've tried just using the drawingdocument.update function, but that hasn't worked either... I'm not sure what else I can try... 

 

Any suggestions?

6 REPLIES 6
Message 2 of 7

Still trying to figure this one out guys.

 

Here's what I've tried:

osheet.update  - This doesn't work

odoc.update  - This doesn't work

odoc.update2  - This doesn't work

 

osheet.suppressed = true

osheet.suppressed = false  - this DOES update the view, but not the annotations And it's really slow.

 

Inventor says that osheet.drawingview(1).uptodate = true, but when you select the view in the GUI, the update button is available, when you press the button the view updates correctly.

 

 

 

Any suggestions?

Message 3 of 7
matt_jlt
in reply to: gerrard.hickson

I'll need more code to be able to understand exactly whats happening so I can try and help you.

Message 4 of 7
gerrard.hickson
in reply to: matt_jlt

There isn't a definite flaw in the code, so unless I'd have to post the entire project so you could replicate the problem, and there's many links to network locations.

 

Perhaps some images will help to explain my problem.

 

Photobucket

 

The above image shows the part (top window) as generated by my add-in. The bottom window shows the drawing of that same part also generated by my add-in. You'll notice that the drawing view does not accurately reflect the part. Instead it shows the part which was used as a template for the creation of the part in the top window.

 

The code below is used to replace the reference to the new created part BEFORE carrying out any other tasks on the drawing (such as re-size the drawing view).

        oTemplate = m_inventorApplication.Documents.Open(sTemplateFileName, False) 'Open the template drawing file
        oTemplate.ReferencedDocumentDescriptors.Item(1).ReferencedFileDescriptor.ReplaceReference(sNewFilePath & PartName & ".ipt") 'Replace the reference of the template part file, with the created part file.

        oTemplate.ReferencedDocuments.Item(1).Save() 'Save the created part file
        oTemplate.SaveAs(sNewFilePath & PartName & sNewFileExtension, True) 'Save the drawing file to match the created parts filename.

 

You'll notice in the image above, that the drawing view is selected, and the 'Update' button in the quick access toolbar is enabled, suggesting that the drawing view is not up to date.

 

 

The image below shows the result of what happens when you press that 'Update' button. Clearly the drawing view now correctly reflects the part shown in the top window, however the scale needs to be adjusted.

Photobucket

 

 

SO... My question is, How do I invoke that Update command from the API? I've tried the update methods of the sheet, and document objects, but they don't work. The Rebuild method is not available to drawing documents.

 

Any assistance would be great!

 

NOTE: I've attached both of those images because they're squashed in this window.

Message 5 of 7
matt_jlt
in reply to: gerrard.hickson

Just a hunch, do you have this problem if you open your template with visibility turned on?

e.g.

oTemplate = m_inventorApplication.Documents.Open(sTemplateFileName, True)

 

I've had a few problems in the past with updating when i've opened a file in the background.

 

also try saving a copy of the IDW before you replace the reference (basically just changing the order of processes)

Message 6 of 7
gerhick
in reply to: matt_jlt

Excellent! Setting the open behaviour to visible = True seems to have done the trick...

 

Thanks for the suggestion!

___________________________________________
Gerrard Hickson
Inventor CAD Administrator || Autodesk Inventor 2012 Certified Professional
Autodesk AutoCAD 2012 Certified Professional|| Bachelor of Technology (Mechanical)

PointZero Design and Drafting
Message 7 of 7
matt_jlt
in reply to: gerhick

No problems, If you want to avoid seeing what is happening on the screen you could try disabling screen updating temporarily then once your addin has finished enable screen updating. It shouldn't give you any updating issues.

 

ThisApplication.ScreenUpdating = False

 

Regards, Matt.

 

If your problem is solved, don't forget to press the Accept Solution button
.

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

Post to forums  

Autodesk Design & Make Report