2D Coordinates vs. Height property?

2D Coordinates vs. Height property?

Anonymous
Not applicable
518 Views
4 Replies
Message 1 of 5

2D Coordinates vs. Height property?

Anonymous
Not applicable

Are the transient geometry 2D coordinate system and the values from the height and width properties different units?

 

I am trying to create automated drawings with iLogic and currently, I am playing around with inserting sketch lines for section views.

 

Currently for length of the sketch lines, I am using:

 

SyntaxEditor Code Snippet

oSectionDrawSketch.Sketchlines.AddByTwoPoints(oTG.CreatePoint2d(0,-(oView1.Height)),oTG.CreatePoint2d(0,(oView1.Height)))

 So basically, I am creating a sketch line (for sectioning) based on the height of my baseview. However, for some reason, the line and baseview do not scale appropriately. If I set the height of my baseview to 5, my line becomes smaller than my circular part. If I increase the height to 15, the line becomes larger. Could this be due to oTG.Createpoint2D and oView1.Height being different units?

0 Likes
Accepted solutions (1)
519 Views
4 Replies
Replies (4)
Message 2 of 5

Owner2229
Advisor
Advisor

If I remember correctly point has your pre-set units (inch/mm/...) but height is in centimeters.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 3 of 5

Anonymous
Not applicable

But what is strange is that the center of my baseview (which is circular) isn't the same value as the points I made it at. Currently, my template is in inches, and I created my baseview at:

SyntaxEditor Code Snippet

Dim oViewLoc As Point2d = oTG.CreatePoint2d(8, 13)

However, the picture shows the actual coordinates of my center in inches.WrongCenter.png 

Doing a quick conversion shows that this means my points are probably in centimeters. This still doesnt explain the sketch lines however. Still using the code in my first post, these are the results I get from 2 different values of oView1.Height.

 

oView.Height = 12

ViewHeight12.JPG

 

oView1.Height = 5

viewheight5.JPG

 

 

See how differently the sketch line scales?

0 Likes
Message 4 of 5

Owner2229
Advisor
Advisor

It is possible that the units of your points are in milimeters or other units, try change it (multiply it).

You are in your code using height size to possition the point in +Y and again for point in -Y, so you should get line twice as long as the height of your baseview.

 

P1 = oView1.Height/25,4 '1 inch is 25,4 mm. You can also try 2,54 for centimeters
P1 = P1/2 'half the possition of the points so the line size match the baseview
oSectionDrawSketch.Sketchlines.AddByTwoPoints(oTG.CreatePoint2d(0,-P1),oTG.CreatePoint2d(0,P1))

Also if you try to set one of the points to [0;0] will the line actualy start in the center?

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 5 of 5

Anonymous
Not applicable
Accepted solution

Actually, it ended up not being that. It ended up being that for some reason, iLogic was multiplying my y coordinate by a factor of 1/view1.scale. So I multiplied it by the same to offset it.

Here are my final coordinates:

 

SyntaxEditor Code Snippet

AddByTwoPoints(oTG.CreatePoint2d(0,((-oView1.Height/2)*(1/oView1.Scale))-1),oTG.CreatePoint2d(0,(oView1.Height/2)*(1/oView1.Scale)+1))

And the result 

 

sketch.JPG

0 Likes