Using a macro to get angle of line

Using a macro to get angle of line

Anonymous
Not applicable
735 Views
8 Replies
Message 1 of 9

Using a macro to get angle of line

Anonymous
Not applicable

add Line "1"                line with name 1 was created befor
LET x = line[1].??????    which command to get the angle
LET a = $x*2
MODIFY
APPARENT $a
ACCEPT

 

I found command for curve but i need for line

compcurve[name].point[name].entry_tangent.azimuth

 

or why don't work command add line"1" in next macros (line with name 1 was created befor):

 

INPUT POINT 'Position of centre' $cenpos1
create workplane SINGLE
POSITION
X $cenpos1_x
Y $cenpos1_y
Z $cenpos1_z
ACCEPT
MODIFY
XAXIS DIRECTION
add line"1"           I have to use command : input free , and  select the line by myself, it is not very good for me
ACCEPT
ACCEPT

0 Likes
736 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

Here you have the solution:

 

Angles of a line
Use the following variables for finding the apparent and elevation angles of a line (these are the same values as shown on the line editing form). 

The commands return a REAL value, with the angle in the current units - degrees or radians).

LINE[xxx].APPARENT 
returns the apparent angle of the line using the current working plane of the currently active workspace 

LINE[xxx].ELEVATION 
returns the angle of elevation that the line makes using the current principal plane of the currently active workspace.

You can optionally specify which principal plane to use:

LINE[xxx].APPARENT.XY 
LINE[xxx].APPARENT.YZ 
LINE[xxx].APPARENT.ZX 
LINE[xxx].ELEVATION.XY 
LINE[xxx].ELEVATION.YZ 
LINE[xxx].ELEVATION.ZX 

I checked the second macro and it works well, I don't have any problems.

 

 

Mateusz

Message 3 of 9

Anonymous
Not applicable

if I run macro step all :

add Line "1"
LET x = LINE[1].APPARENT.XY
LET a = $x*2
MODIFY
APPARENT $a
ACCEPT

 

I have error after second line : invalid command = LET x = LINE[1].APPARENT.XY 

 

0 Likes
Message 4 of 9

Anonymous
Not applicable

I tried to run this macro and it works perfectly.

Don't you have variable 'x' already defined?
Try to change the name of variable, e.g. 'x1', 'a1'...


Mateusz

0 Likes
Message 5 of 9

Anonymous
Not applicable

changing the name of variable don't help? I work i Power Shape 2010 and you? could differen version make affect the outcome

0 Likes
Message 6 of 9

Anonymous
Not applicable

maybe I need to declare type of variable first ?

0 Likes
Message 7 of 9

Anonymous
Not applicable

can you run this full macros in new model

 

VIEW EDIT TOP

CREATE LINE
 SINGLE
 -63, -24, 0
 97, 44, 0
select clearlist
create datum
SINGLE
 -63, -24, 0
MODIFY
XAXIS DIRECTION
add Line "1"
ACCEPT
ACCEPT
select clearlist

 add Line "1"
MODIFY
APPARENT -10
ACCEPT
select clearlist

add Workplane "1"
MODIFY
XAXIS DIRECTION
add line "1"
ACCEPT
ACCEPT
select clearlist

VIEW EDIT TOP

 

it have to create line, then workplane, then rotate workplane like line direction, then turn line on -10, and again rotate workplane like line direction but when I run macros workplane don't rotate? why!!!!!!!????????????Smiley Sad

0 Likes
Message 8 of 9

Anonymous
Not applicable

I'm working at PowerSHAPE 2015.

 

 

Mateusz

0 Likes
Message 9 of 9

Anonymous
Not applicable

Easier way to get angle of line.

 

let $lin = selection.name[0]
let $b = LINE[$lin].APPARENT
PRINT ERROR' The line angle is... '$b ' Degrees'

 

 

 

0 Likes