Is it possible to extract the VBA program from the inventor model sketch?

Is it possible to extract the VBA program from the inventor model sketch?

gparamasivam
Enthusiast Enthusiast
735 Views
10 Replies
Message 1 of 11

Is it possible to extract the VBA program from the inventor model sketch?

gparamasivam
Enthusiast
Enthusiast

Hi 

Is it possible to extract the VBA program from the inventor model sketch?

If possible kindly help.

0 Likes
736 Views
10 Replies
  • VBA
Replies (10)
Message 2 of 11

jjstr8
Collaborator
Collaborator

I'm not sure what you mean.  Can you provide more details of what you're trying to do?

0 Likes
Message 3 of 11

bradeneuropeArthur
Mentor
Mentor

Do you mean if the sketch is recorder and can be reproduced bij VBA code?

There is no macro recorder for Inventor!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

0 Likes
Message 4 of 11

WCrihfield
Mentor
Mentor

If I'm understanding you correctly, you want some single iLogic rule or VBA macro that you can run, that will record all aspects of an existing sketch, then be able to reproduce that sketch, at some later date/time, within another model file, is that correct?

 

If this process were possible to do entirely by code, the solution would have to include multiple things, not just one iLogic rule or VBA macro.  First of all, the code has to know what to look for and where it is (maybe only the 'first' PlanarSketch in the 'active' document).  Then it must include tons of code for finding and inspecting every instance of every object type that may be involved, then it must record all their property values and related data to some external storage in a file (or multiple files) on disk.  The code would have to know where these file are, what there names are, where to put this data in that file, and how to format it.  Then you would have to have a separate iLogic rule or VBA macro that you can run when you have the other model document open, that will look at these data files on disk, then be able to somehow interpret all the data, so that it can be used to recreate whatever was in the source model.  I can't be sure if it would even be possible to create a solution for this, but it would likely be a huge and complex task, and you would most likely have to know a ton about programming and how it all works to be able to make it all work without errors.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 11

gparamasivam
Enthusiast
Enthusiast

Thank you @WCrihfield 

Your understanding is very correct. I need the alternate method of ifeature, it could be easy revised.

So i am searching another method. (VBA or iLogic)

0 Likes
Message 6 of 11

WCrihfield
Mentor
Mentor

Just thinking here about other possible work flows.

Would it be an acceptable solution to have a 'master' or 'Template' model file that you could always reference for source content.  Then, maybe without having to store tons of data to external non-Inventor files, maybe a single rule/macro could attempt to copy stuff from that 'master'/'template' to your current model document.  Or maybe instead of having that master/template, you could just include something near the beginning of the code that allows you to select 'source' document, then either also select the 'target' document, or use your currently 'active' document as the 'target' document.  Then copy stuff from the source to the target directly.  This process might avoid 3 major parts of the earlier mentioned process (writing all types of data to files, having those files, then reading from those files).  Even then, this might still be a complicated process, but it really depends on your expectations/needs.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 11

jjstr8
Collaborator
Collaborator

@gparamasivam  I'm not clear on why you can't use iFeature.  What would you need to revise or change that you couldn't do with iFeature?

0 Likes
Message 8 of 11

gparamasivam
Enthusiast
Enthusiast

Yes.. You are correct....is there any other option available in reproduce the sketch and features?

0 Likes
Message 9 of 11

Anonymous
Not applicable

One solution to be able to reproduce sketches is to create sketched symbols in a template document. In the template document you create sketched symbols and save them in that template document. This is then referenced and the sketched symbols can be inserted into the drawing. The way that I am thinking would be for .idw drawing files.

0 Likes
Message 10 of 11

gparamasivam
Enthusiast
Enthusiast

I am asking about model sketch reproduce method  (.ipt)

0 Likes
Message 11 of 11

A.Acheson
Mentor
Mentor

It isn’t possible to work backwards from a user part file to ilogic /VBA code creation, that I know of.


But  it is possible to work forward from 
ilogic /VBA code to create a part file.

Edit:

The API help has a few samples and the necessary documentation

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/vba-make-simple-part-completely-from-vb...

 

Here is a post from this forum to create a part in an assembly.  
https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/creation-of-part-using-ilogic/td-p/6334...

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes