Skip to main content
15-Moonstone
May 8, 2024
Solved

Create a Simple Draft sketch line

  • May 8, 2024
  • 2 replies
  • 2413 views

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?

Best answer by RPN

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

2 replies

15-Moonstone
May 9, 2024

Sorry, misinterpreted the question. This is about Toolkit.

msteffke15-MoonstoneAuthor
15-Moonstone
May 9, 2024

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

18-Opal
May 9, 2024

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.

msteffke15-MoonstoneAuthor
15-Moonstone
May 9, 2024

 

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

 

msteffke15-MoonstoneAuthor
15-Moonstone
May 9, 2024

Thanks I will take a look at that!.