cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Create a Simple Draft sketch line

msteffke
14-Alexandrite

Create a Simple Draft sketch line

I m struggling to find a way to create a single draft entity line on a drawing sheet.   Looking to create a line at 0,0 and go to 1,0 (x direction) or from 0,0 to 0,1 (y direction).   Can someone point me in the right direction?

ACCEPTED SOLUTION

Accepted Solutions
RPN
17-Peridot
17-Peridot
(To:msteffke)

Yes, that is wrong, thus will only create temporary lines, or items.

 

One example as well in UgDtlentityExamples.c

 

/*====================================================================*\
FUNCTION : UsrLineentityCreate()
PURPOSE : Utility to create a line entity between specified points
\*====================================================================*/

View solution in original post

7 REPLIES 7
JB_87049
15-Moonstone
(To:msteffke)

Sorry, misinterpreted the question. This is about Toolkit.

msteffke
14-Alexandrite
(To:JB_87049)

My bad.  Yes I am trying create the line in ProToolkit, with no user input.  Want the line to appear automatically.

RPN
17-Peridot
17-Peridot
(To:msteffke)

You need the Matrix of ProDrawingBackgroundViewGet()

 

The window matrix is required as well, because as far I remember x,y,z are screen coordinates.

Multiply the line coords by using the inverse (?) with the Window Matrix, something like this, beside of creating the line.😉

 

There should be an example in the folder tree.

msteffke
14-Alexandrite
(To:RPN)

 

Thanks 17-peridot,  Is the function to create the line  ProGraphicsLineDraw ?    The line i am creating represents the grain direction on a stainless steel sheetmetal flat.   If I have the line on a special layer it can let our CNC nesting software know the direction of grain constraint.  The line is to be on a drawing with a view of the flat. 

 

/* Transform points by matrix */
    ProUtilPointTrans( trf_matrix, point1, point1 );
    ProUtilPointTrans( trf_matrix, point2, point2 );

    /* Draw the line */
    ProGraphicsPenPosition( point1 );
    TEST_CALL_REPORT( "ProGraphicsPenPosition()", "ProTestGraphicsLineDraw()", 
			(ProError)0, 0 );
    ProGraphicsLineDraw( point2 );
    TEST_CALL_REPORT( "ProGraphicsLineDraw()", "ProTestGraphicsLineDraw()", 
			(ProError)0, 0 );

 

FV
17-Peridot
17-Peridot
(To:msteffke)

Mark you are using a wrong API, what you need is ProDtlentityCreate(...). There is  protk example file TestDtlentity.c with working code.

HIH

msteffke
14-Alexandrite
(To:FV)

Thanks I will take a look at that!.    

RPN
17-Peridot
17-Peridot
(To:msteffke)

Yes, that is wrong, thus will only create temporary lines, or items.

 

One example as well in UgDtlentityExamples.c

 

/*====================================================================*\
FUNCTION : UsrLineentityCreate()
PURPOSE : Utility to create a line entity between specified points
\*====================================================================*/

Announcements


Top Tags