Jump to content
Developer Wiki and Function Reference Links ×

RunTempTool draws offset


Recommended Posts

I have noticed that in certain VW-documents the preview lines called with RunTempTool show at a wrong location, with an offset. The actual objects are implanted at the right location, and the variables used to compute the locations are also all correct.

So there must be an issue with the temporary line functions themselves, vstDrawCoordLine vstDrawCoordArc etc.

Has anybody experienced this? As of now Ive not been able to recreate whatever causes this to happen in some documents.

Link to comment

Is there a custom user origin? I can't remember off the top of my head, but a number of functions always use the internal origin. You need to get the user origin and offer your coordinates by that amount. You may also have to take rotated plan into account.

  • Like 1
Link to comment

Yes I think the documents work with some kind of secondary origin. Maybe from georeferencing (Probably not a rotation because everything is still displayed with the right angles). I will have to look into that.

Link to comment

Update: It was because of the user origin as you suggested. I could fix it easily with this bit of code:

 

                          custom_origin:= FALSE;

 

                          GetOrigin(x_origin, y_origin);

 

                          IF ( x_origin <> 0 ) OR ( y_origin <> 0 ) THEN
    
                                custom_origin := TRUE;

 

And inside the TempTool Function:

 

                           IF custom_origin = TRUE THEN BEGIN
                            
                                x := x + x_origin;
                                y := y + y_origin;
                                
                            END;

 

Link to comment

Taking the Plan rotation into account has been a little more challenging but I got it to work now:

 

Checks if Plan is rotated:

 

    plan_rotated := GetPref(92);

   

Returns Plan Rotation:


    PlanRot := GetPrefReal(93);

 

Then a little math:

 

    theta:= Deg2Rad(PlanRot);

 

    rotX:= X * cos(theta) - Y * sin(theta);
    
    rotY:= X * sin(theta) + Y * cos(theta);

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...