Hi Karthick,
What iLogic is doing is looking through the specified Drawing View and searching for a Line of the specified size. The Line is placed on the drawing page and has scaled dimensions appropriately (ie. if the model size was 5" and you've scaled the view to 1/2, you should tell the program to search for a 2.5" line). This is why we enter this formula into the dimension length section of the linear dimension code (5*DrawingViewScale/2.54). I am searching to dimension the left side of your model which is 5cm (50mm), but the Drawing (.idw) sheet dimensions lines according to inches (if you have selected an imperial DWG sheet), so we must convert cm to inches by dividing by 2.54. We multiply by the DrawingViewScale which is defined by you earlier in the code, in order to tell the program what we have scaled the view by and therefore to search for this scaled dimension.
Now that I think of it, this is probably where the issue is occuring. I remember when you sent me your files that you were using metric parts, I'm assuming that you're now using metric drawing files as well (.idw). I have only used imperial drawing files previously.
--->>> My thinking is (as stated in my first paragraph) that the drawing is now thinking in metric (cm) instead of imperial (inches) like it was for me. I am not positive of the units, so you may have to play around a bit (eg. convert the 5cm in the CreateLinearDimension into milimeters or meters), so that the drawing will be able to find the Line you're looking for.
Did you create the projected view? Or was it created with the Drawing Automation?
If it was placed by the code, there may be a small issue which can easily be fixed. The iLogic code places the views in the drawing according to the specified orientation, we've specified this to be "Top." If you open a drawing file (.idw) and press "Base" as if you were placing a view, look on the right hand side of the screen that pops up where you'll see "Orientation." These predefined names are what you can enter into the iLogic code in order to place the orientation you desire. Try placing your model to see which way it is oriented, you can change this by manipulating the view orientations of that View Cube in your 3D model. You must be placing these views in accordance to the dimension you wish to find (and place) on the view, or else iLogic will never be able to find it since it does not exist in the view you've told it to look for.
//// The Error Message
This error message will become VERY familiar to you as you go through creating and debugging your code. What I have found it to mean (in simple terms), is it cannot find the dimension you have told it to look for. Simply, you've told the code to look in ______ view and find a Line of ____ size, if it cannot find this, the error code you show will come up. This should be the meaning of this error message most of the time it appears.
//// Understanding of CreateLinearDimensions
----- Informationand options about function ------
'CreateLinearDimension (oDrawingDoc, oDrawingView, DimensionLength, DirectionOfDim, OffsetDistance, DimensionLocation, ReferencedDim)
'WHAT IT DOES: Used to place linear dimensions on Horizontal or Vertical Lines
'CODE RETURNS: The Dimension for use in of Functions such as Aligning Text
'oDrawingDoc: The Drawing Document which the View exists in
'oDrawingView: The View you which to place the dimension on
'DimensionLength: The length of the Curve you want to dimension (Mine are Driven by a parameter in the Model)
'DirectionOfDim: A String which specifies the orientation of the line to look for
'OPTIONS: ("Vertical", "Horizontal")
'OffsetDistance: A number which specifies the distance to Offset the text from the line
'(Must be negative Or positive based on your knowledge of where the line is (ie. "-" if Left and "+" if Right))
'Or you can place the dimension inside the view by choosing the appropriate sign
'DimensionLocation: Multiple lines can have the same length, this String specifies which line to choose. Closest to the given side
'OPTIONS: ("Top", "Bottom", "Right", "Left")
'ReferenceDim: True or False as to whether this dimension is to be a referenced dimension
'(This is selects between 2 Styles previously set up in the Drawing Template)
--- Example Code ----
'Place Top_Rack View
TopRackView = CreateDrawing_PlaceViews ("Top_Rack", DrawingViewScale, "Top", False, oTopRackView, oView2, oView3, oView4)
CreateLinearDimension (TopRackView, oTopRackView, 6*DrawingViewScale/2.54, "Vertical", 2, "Right", False)
----- Explanation ----
For this function, you've created and named a view when you placed it (ie. "TopRackView ="), and now can tell the iLogic code you wish to search in this view by simply entering "TopRackView."
In the code shown above, the "TopRackView =" should actually be removed (I apologize that this was my own mistake, I am only starting back into this program). By setting something "=" to the CreateDrawing_PlaceViews function, you are specifying a document, this has already been previously done in the code by this line:
----
Assem_DrawingDoc = CreateDrawing_PlaceViews (AssemblyDocName, DrawingViewScale, "Right_Project", True, oBaseView, oRightSideView, oProjectView, oView4)
----
Therefore the code should read:
----
'Place Top_Rack View
CreateDrawing_PlaceViews ("Top_Rack", DrawingViewScale, "Top", False, oTopRackView, oView2, oView3, oView4)
CreateLinearDimension (Assem_DrawingDoc, oTopRackView, 6*DrawingViewScale/2.54, "Vertical", 2, "Right", False)
----
In CreateDrawing_PlaceViews, we've specified that we only wish to create the "Top" view (See function description in the beginning of the Drawing Automation code for more options). Therefore, only the oView1 space will be used, in which case we've specified we want to title this view "oTopRackView." You can now access this view on the drawing at anytime throughout the "Sub Main()" function by refering to "oTopRackView."
Let's look back at the base code for CreateLinearDimension:
----
CreateLinearDimension (oDrawingDoc, oDrawingView, DimensionLength, DirectionOfDim, OffsetDistance, DimensionLocation, ReferencedDim)
----
We've now specified the Drawing Document (oDrawingDoc: Assem_DrawingDoc), as well as the View we wish to place the view in (oDrawingView: oTopRackView), the rest of the code is to specify the dimension itself.
DimensionLength: The length of the dimension you wish to locate in the drawing (must be converted to use the drawings (.idw) length by multiplying by DrawingViewScale and other methods appropriately.
DirectionofDim: This tells iLogic which orientation the line is in, so it narrows down its search (ie. if the Line you are looking for runs vertically, type "Vertical," if it runs horizontally type "Horizontal")
*** Note that text Strings must be wrapped in " " quotations with spelling and capitals also taken into account
OffsetDistance: The distance you want the dimension to be placed away from the line it was taken from (ie. 2" to the left = -2)
DimensionLocation: In some cases, there may be 2 lines that are very similar within the view, in this case, you can specify closer to which side you want to take it from (ie. "Right")
***** Important May Need Change ******
ReferencedDim: I had made a new style in my drawing template to incorporate referenced dimensions. If you don't know what a referenced dimension is, you do not have to worry about this and I believe you can simply place False here everytime, the code should still take the default dimension style in your drawing template everytime. My referenced dimension style simply placed ( ) Brackets around the dimension if I put True here.
^^^ If you would like this, I can take you through the process to add this to your drawing template
I believe that answers all your questions for now, let me know if this helped or if you have any others.
MRattray, feel free to ask any further questions you may have as well, I can try to assist you with your assemblies if you have questions.
Thanks
Mitch