You can't just shove an extra enum in there. He was probably trying to do the same thing as you and then found out he couldn't. He should have deleted that dingle berry out before publishing it.
Remember that everyone on the internet knows everything and if someone can post on a forum everything he does is perfect.
Unfortunate that it's not that easy
Now I'm trying to save the drawing as I'm trying to run the rules inside of my template automatically
I need to find out how to save the document and the closing it will be pretty much the same I assume
This will save and close the document.
This will close without saving.
This will save without closing.
ThisDoc.Document.SaveAs(filePath & "\" & fileName & ".idw" , False)
This does a save-as without closing. This is copy/pasted out of a sub that I'm using it in where filePath and fileName are strings that hold the obvious information. In other words there are earlier in the code several lines like the following:
Dim filePath As String Dim fileName As String filePatch = "C:\temp" fileName = "temp"
You could also just replace that garble with a regular line of text like: "C:\temp\temp.idw"
I don;t remember what he False is for and it's time for me to go home.
I figured out how to Close the document which is similar to the "ThisDoc" command except it's not ThisDoc as the rule is being run in the assembly but I want to control the Drawing Document which technically doesn't exist yet as it hasn't been saved.
I learned to use the Object Browser to a little more extent, it looks like I have to use this
"DrawingDocument.Save2([SaveDependents As Boolean = True], [DocumentsToSave])"
I can't figure out what this DocumentsToSave means
Thanks for your help though
I've now Saved the Document by doing a SaveAs instead as I can actually figure out how to do this, and once I open this document shortly after the SaveAs my rules trigger. So everything seems to being flowing as I want it to unless there is a better way of coding it.
All I need now is to figure out how to get those 4 options set in the view
I'm not very good at posting my questions in one message...
As I am waiting to figure out how to set those view options, I'm looking into attempting to dimension the views.
Looking at the API, I had trouble trying to use the "Add Linear" for "GeneralDimensions". I'm sure that I filled out one of the sections wrong in the brackets but I can't figure out which one. I tried to use "kStartPointIntent" and "kEndPointIntent", but I don't understand how they would know what to select.
Moving on after trying that, I'm now looking at the "GetRetrievableDimensions" in "GeneralDimensions". I do not know what the code wants from me when it asks for the "ModelObject"
I inserted "Add" into this location where it asks for "ModelObject" and I get this error which I'm assuming means that I'm using the API improperly
Error in rule: Rule21, in document: Rect_Transition_Chute_Generator.iam (MASTER iLogic Assembly)
Public member 'DrawingDimensions' on type '_DocumentClass' not found.
About the options to create the view initially:
The Level of Detail will be taken directly from your model document. If you activate the LOD that you want before running the rule, that's the LOD that will be shown in the drawing views.
You can add the View Representation name to the function to create the base view:
oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, 3/16,kFrontViewOrientation, kHiddenLineDrawingViewStyle, "Default")
It looks like the API doesn't provide a way to specify the options for reference components when you create a view:
Line Style = "As Parts"
Hidden Line Calculation = "All Bodies"
About the dimension error: are you looking for a DrawingDimensions object directly on the Document? It's on the Sheet instead:
Again, I would recommend using VBA or VB.NET to develop this code. It might take you a while to get started, but it will save you time in the long run.
Thank for the help Mike, I'll give it a shot and see if I can find a way around those options.
I will try to do it in VBA, the only issue is that I don't have "time" to learn the code in depth in order to do what I like. But, nop harm in giving it a shot.
Hello and welcome to Monday
In doing some more reseach and making the changes that Mike suggested with a few extras of my own, the code and drawing have improved.
With the research I have found a way to place dimensions but the suggested way is only possible by manually pre-selecting the line then running the vba code. This worked and placed the dimension, and I understand how to manipulate this code to change the type of dimension as well as where it is placed.
But as you know, I do not wish to manually pre-select the line. Through more looking around a found a user who was looking to apply centerlines in views (which I will also need to do later on).
One of the suggested methods is to use the "ModelEdge" object. I looked in the object browser and did not find anything their myself but I could be missing something.
To me, this sounds to be exactly what I'm looking for. If I can pre-select the line by programmically calling the model edge I wish to dimension, I can run this code that dimensions the selected line.
You can find the code so far attached
The commented line "oCurve = oDrawDoc.SelectSet(1).Parent" is what was used to get the manually selected line
Here is the Centerline forum, Message 13 is the reference:
I just realized some numbers in that code may look a little weird.
I use a drawing template that I've put existing codes into like this one which resizes the view and places them where I'd like.
I've also tried this as a test but it does not work and an error comes up once it hits this portion of code. See attached "Test Code"