Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom drawing views

10 REPLIES 10
Reply
Message 1 of 11
DavidLong
755 Views, 10 Replies

Custom drawing views

Custom drawing views

 

I am trying to add an IvBaseView from a custom angle.  When I try to set “viewOrientation = :Arbitrary”, I get a "Type mismatch error."  I am also trying to use the parameters cameraTarget, cameraEye, cameraUpVector, etc, but the drawing doesn’t change when I update the values.

 

What is the best way to add views from specific angles?

10 REPLIES 10
Message 2 of 11
DavidLong
in reply to: DavidLong

If I can't create a customized view at render time, can I add additional features to a template drawing without deleting the existing sheet? 
 
For example, to add a GeneralNote, I need to specify the sheet (as a part).  How would I set this sheet to the original "Sheet:1" of my template?
Message 3 of 11
Jon.Balgley
in reply to: DavidLong

[Better late than never...]

 

You can definitely create custom (aka arbitrary) views.  I just tried it (in 6.1 R2, just released last week), and it worked in a simple test case.  The important parameters are:

 

(These are pulled from the dynamic rules ... I entered them interactively rather than writing a new design)

 

Parent Rule viewOrientation As Name = :arbitrary
Parent Rule cameraEye As Point = point(-200, -200, -200)  
Parent Rule cameraTarget As Point = root.origin
Parent Rule cameraUpVector As Vector = vector(-1,-1,0)

 

(This is essentially a bottom-iso view.)

 

Image-0354.png

 

When I changed to the camera up vector to an illegal value, the view disappeared with no error.  That's a defect -- should give an error.   But when I changed it to a different legal value, then the view updated as expected.

 


Jon Balgley
Message 4 of 11
Jon.Balgley
in reply to: DavidLong

Re: adding notes to template drawings.  I can't recommend this procedure.  Maybe you can get it to work using the Inventor API, but the design isn't "designed" to work that way.


Jon Balgley
Message 5 of 11
DavidLong
in reply to: DavidLong

A standard view works with no problems:

	Child TestView2 As :IvBaseView
		viewOrientation = :IsoTopRight
		Model = model
		viewScale = .025
	End Child

 

 

A custom view results in an error:

	Child TestView As :IvBaseView
		viewOrientation = :arbitrary 
		Model = model
		viewScale = .025
		origin = Point(0,0,0)
		cameraEye =  Point(-200, -200, -200)
		cameraTarget = root.origin
		cameraUpVector = Vector(-1,-1,0)
	End Child

 

Error:

Exception in function iv_updateSheet

 Exception in function iv_createBaseView

 Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

 

Any ideas?

Message 6 of 11
Jon.Balgley
in reply to: DavidLong

Still works for me.  

 

What release are you using?  I don't think this should matter as long as you're running something fairly recent, because I took a quick look at the history of the related system code, and didn't see any relevant recent changes, but maybe I missed something.

 

Here are my sample rules:

 

	Child view1 As :IvBaseView 
		viewOrientation = :isoTopRight
		model = root 
		viewScale = 0.25
		origin = Point(150,200,0)
	End Child

	Child view2 As :IvBaseView 
		viewOrientation = :arbitrary
		model = root 
		viewScale = 0.25
		cameraEye = Point(100, 0, 50)
		cameraTarget = root.origin
		cameraUpVector = Vector(0,0,1)
		origin = Point(300,200,0)
	End Child

 

2013-01-24_1510.png

 

Note that the exact 'eye' and 'target' points really matter.  They have to be sized properly for your model.  At least in terms of orientation.  In my example above, the model is about 200mm square, and a little more than that in the Z direction.  So when I change the Z-coordinate of the cameraEye value, I get a higher-or-lower view, but still from the side.

 

 


Jon Balgley
Message 7 of 11
Jon.Balgley
in reply to: Jon.Balgley

PS.  The only thing that I see that could possibly be different from your iso view vs. your arbitrary view is "root.origin".  Should that be "model.origin" instead?


Jon Balgley
Message 8 of 11
DavidLong
in reply to: DavidLong

Thank you for your attention.

 

I am using 5.1.

 

For the case I am testing, root.origin and model.origin are the same point.  I have experiemented with a variety of values for the various camera parameters, and I always get the same type mismatch error.  The part is definitely at the origin, so I expect that I should be able to look at that point from anywhere and see the part.  I don't think those values are the issue.

Message 9 of 11
FarrenYoung
in reply to: Jon.Balgley

I am also having a problem with this functionality in 5.1.

 

Your code works correctly only if the model is root.

If I change the model to root.SubAssembly I get the following error:

 

Exception in function iv_updateSheet
 Exception in function iv_createBaseView
 Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

If I change the viewOrientation to :IsoTopRight  it will draw correctly.

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************
Message 10 of 11
morgangardiner
in reply to: DavidLong

Jon;

could you explain how to determine what the Point would be if I wanted a view (using your example) that was rotated  45 degrees in the negative direction. ( this would put the 45 degree angle at 0 degrees and looking straight at you in the view.

or another example I want a view with the camera 29 degrees up from 0 about the z axis.

and what does cameraUpvector actually do.

 

Message 11 of 11

Morgan:

The camera settings eye and target create a ray from the eye to the target.  The locks the camera onto "looking at" the target point, but there is one more degree of freedom that needs to be locked down, and that is the orientation of "up" on this viewing vector.  So that is what the upVector is.  It will make that direction +Y in a view that uses it.  Generally speaking, if you consider the XY plane to be "ground", then a camera up vector of unitZ will be what a human would expect.  But if you want a top view, then you can't use that, since it is parallel to the view axis, so most people would chose unitY for a top view.  [I am ignoring here that Inventor seems to have its own definition of "standard" views.]

 

I can't answer your specific "how do I" questions, because I don't quite understand your relative terms.  "Rotated" and such imply a starting point.  Just say where you want the eye to be, what point you are looking at, and which direction should be "up" in the view, and you are done.

 

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

Post to forums  

Autodesk Design & Make Report