Attached you'll find the FULL DRAWING CODE as well as a photo of what this code produces.
*This code was created in run directly in iLogic
I have Fully commented it to make it easier to understand and have created what is probably a page of comments at the top of the code describing how to use each Function.
This is on and off research throughout 2 months of searching through threads and finding different codes to learn from.
Except now it's ALL IN ONE PLACE on this thread!!!
Keep in mind that my code is run through an assembly which is also fully parameter based and runs on multiple iLogic rules. This is why all of my dimensions are Names as they are parameters being passed into the sub.
The code places all of the views at a single point when they are created. These views are then moved based on a code in the Drawing Template. This code is not complete but I have attached the one I use right now for reference. Also keep in mind that Parameters are used here which is why you might see names where numbers or Letters should be.
I hope this helps you while your learning the code and API. Here are some other threads I used:
Please feel free to ask any questions while I am still available
Kudo's if this helps you!
Thanks for all Your Help!
This is really awesome! Thanks a lot of sharing your finished product, as it should come in handy for pushing automation to higher (sexier) levels. It's a wonderful thing to see this all come together (more so for you I'm sure!).
I'm going to post a revision of the code as I've added a few more subs for ordinate dimensions and centerlines as well as changed a few things.
But first I have a question, if you see the attached photos, I am trying to place a Hole Thread Note.
I've tried using different intent points or just the drawing curve while adding the note, but I always end up getting the "Wrong" note as the leader is on the other side of the circle
I am using an ilogic rule to make center lines with an event trigger (before saving document)
On Error Resume Next
On Error Resume Next
On Error Resume Next
Is there a better way to do this? The obvious problem is if theres is au 4th view...
Also, because of automated centerlines default settings, the only centerlines beeing drawn are the one where you see a hole function as a circle. No center lines are being drawn on cylindcrical shapes or patterns,
Is there a way to set the automated centerlines options so that they remain a certain way and not always revert to only drawing center lines on a hole top view?
Unfortunately I currently do not have access to Inventor to fully assist you, but the following code should be something like what you're looking for. A few minor tweeks might be needed.
For the centerline settings, there is a way to change this programmically with the API, but as I said, I do not currently have access to Inventor.
>>> If you are using a template drawing, you can set the default Automated Centerlines but accessing "Document Settings" under the "Manage" tab. I do not remember how to direct you farther from here, but once you set up the centerline's default options, these centerlines will always be placed whenever you run "SetAutomatedCenterlineSettings"
' Dim oNumView As DrawingView ' Dim ViewCount As Integer ' Dim StartCount As Integer ' ' ViewCount = 0 ' StartCount = 0 '//////////////////////////////// Counts the number of drawing views on the sheet ' For Each oNumView In ActiveSheet.DrawingViews ' ViewCount = ViewCount + 1 ' Next '//////////////////////////////////// Places Centerlines on all of the drawing views ' For StartCount = 1 To ViewCount ' ActiveSheet.DrawingViews(StartCount).SetAutomatedC
enterlineSettings() ' Next
Just out of curiosity, why do you do it with two loops? Why not just set the centerlines in the for each loop?
Also, if you change the names of your views from default or if you delete views I think the code will fail. It will look for view 4 which no longer exists due to either now being view c or becuase it was deleted and return an error.
I think this will work better, although I'm much too lazy today to test it.
dim oview as drawingview
dim oviews as drawingviews
views = activesheet.drawingviews
for each oview in oviews
It finally works!
Thank you all for your help.
Here is the code:
Public Sub LignesAxes()
Dim oNumView As DrawingView
Dim ViewCount As Integer
Dim StartCount As Integer
Dim oview As DrawingView
StartCount = 0
'number of drawing views
ViewCount = ThisApplication.ActiveDocument.ActiveSheet.Drawing
'define collection of views objects
Set oviews = ThisApplication.ActiveDocument.ActiveSheet.Drawing
' Places Centerlines on all of the drawing views
For StartCount = 1 To ViewCount
I initially used a single loop to do a lot of my tasks, but for some reason the program would fail as it would not search correctly through every single object. By doing it this way with 2 loops, I am telling the program to access that specific object through it's index and perform the neccessary tasks.
I believe you're also talking about the function, where I have the filler views as parameters. You are right that the program will not work if these are removed. These are just place holders as all parameters that consist in the function need to be filled in for the program to run. A previous parameter in that same function tells it what views to use, and the rest of the filler views are not taken into account.
Sorry for the long delay
Your codes are really awsome. Could you attach the inventor assembly file releated to this code. Its very helpful for me.
Unfortunately I cannot provide you with the files themselves do to company policies, but can assist you with any further questions you may have.
I may be able to provide screenshots as well for specific scenarios
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.