Line grid to match a any face

Line grid to match a any face

michael.bouwer
Contributor Contributor
397 Views
4 Replies
Message 1 of 5

Line grid to match a any face

michael.bouwer
Contributor
Contributor

hello
please help


i'm new to ilogic and VBA would like help to create a line grid sketch that will cover any face you select
currently i can only create this grid if the selected face is a rectangle
i have no idea how one would go about creating a gird that will stop at the extents of the face
below is an example of what it would look like if it has completed the grid
even if someone could help me finding the end points of each edge in a face

michaelbouwer_0-1692099137925.png

 

0 Likes
398 Views
4 Replies
Replies (4)
Message 2 of 5

michael.bouwer
Contributor
Contributor

i'm trying to build a rule that will draw a mesh pattern as below regardless of shape

michaelbouwer_0-1692163862610.png

 

0 Likes
Message 3 of 5

michael.bouwer
Contributor
Contributor

so i've got this to count the no of edges and get end points but having trouble getting co-ordinates out
why do i get

Error on line 25 in rule: Rule0, in document: mesh_rule.ipt

Object reference not set to an instance of an object.


oDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition
oCompDef = oDoc.ComponentDefinition
Dim oEdgeLoop As EdgeLoop
test = 0


Dim oFace As Face
oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a Face ")
'make sure it is a planar face
If oFace.SurfaceType = SurfaceTypeEnum.kPlaneSurface Then
oPlanarSurface = oFace.Geometry
For Each oEdgeLoop In oFace.EdgeLoops
Dim oEdgeUse As EdgeUse

For Each oEdgeUse In oEdgeLoop.EdgeUses
test = test + 1
Dim oEval As Curve2dEvaluator
oEval = oEdgeUse.Evaluator
Dim oMinU As Double
Dim oMaxU As Double
oEval.GetParamExtents(oMinU, oMaxU)
Dim oFaceUV() As Double
Dim oParams() As Double
oParams(0) = oMinU
oParams(1) = oMaxU
oEval.GetPointAtParam(oParams, oFaceUV)
Next
Next
Else
End If

0 Likes
Message 4 of 5

FINET_Laurent
Advisor
Advisor

Hi @michael.bouwer

 

I would try to create a square and check if it's four corners belongs to the inside of the shape. Then place a square next to it etc... Here is an interesting topic : 

How to check if a given point lies inside or outside a polygon? - GeeksforGeeks

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 5 of 5

michael.bouwer
Contributor
Contributor

thank you so much for the reply,
i can see how this can work to know how long each line should be a step in the right direction
but now the problem is i dont have a strong coding background (just been fiddling with ilogic)
do you know how i could convert this to vba so that i can understand it better, please
again thanks for the reply

0 Likes