Skip to main content
15-Moonstone
May 8, 2024 9:00 PM UTC
Solved

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?

RPN
RPNAnswer
18-Opal
May 9, 2024 9:12 PM UTC

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
\*====================================================================*/

7 replies

15-Moonstone
May 9, 2024 11:16 AM UTC

Sorry, misinterpreted the question. This is about Toolkit.

Translate
msteffke15-MoonstoneAuthor
15-Moonstone
May 9, 2024 12:36 PM UTC

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

Translate
RPN
18-Opal
May 9, 2024 5:54 PM UTC

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.

Translate
msteffke15-MoonstoneAuthor
15-Moonstone
May 9, 2024 6:31 PM UTC

 

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 );

 

Translate
FV_01
May 9, 2024 7:13 PM UTC

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

HIH

Translate