Zoom-independent curve pattern

Eyeshot's Entity.LineTypePattern is zoom dependent, which means that the size of the dashes get bigger or smaller depending on the zoom level:

Capture.PNG Capture2.PNG Capture.PNG

If you want the size of the dashes to remain the same regardless of the zoom level, similar to what AutoCAD® does for selected entities, you can inherit from the relevant Entity class and override the Entity.Draw() method to enable the OpenGL line stipple feature, like this:

class MyCircle : Circle 
{ 
        public ushort Stipple = 0xF0F0; // See http://www.opengl.org/sdk/docs/man/xhtml/glLineStipple.xml 

        public MyCircle(double x, double y, double z, double radius) 
            : base(x, y, z, radius) 
        { 
        } 
protected override void Draw(DrawParams data) { gl.Enable(gl.LINE_STIPPLE); gl.LineStipple(1, Stipple); base.Draw(data); gl.Disable(gl.LINE_STIPPLE); } }

This will be the result:

Capture.PNG Capture2.PNG Capture.PNG

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

Comments

3 comments
  • Seems like this should be the default behavior.  Having a line pattern that scales with zooming is NOT what I'd expect.

  • Can the argument patternLen be used to change the size of the pattern?  patternLen = 0 by default, but patternLen <> 0 (e.g. 1.0) causes an exception.

     

     

  • The default bevhaviour (the pattern scales with the zoom) is consistent with AutoCAD®.

    The "patternLen" argument must not be changed. It's a data computed internally for internal use.

    If you need to scale a pattern size, you should scale the components of the Entity.LineTypePattern.

Please sign in to leave a comment.