🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

split a group of lines using points in the model

User: "RajeshSRSamsung"
Altair Community Member
Updated by RajeshSRSamsung

Hi,

I have a model of lines.

I made point at the crossing location of lines using the option 

image

and finally the model is as shown below.

image

Now i am trying to write a tcl program to split these lines at these points using a for loop.

the code i try to make is as below.

*createmark lines 1 "displayed";
*createmark points 1 "displayed";
set LineList [hm_getmark lines 1];
set PointList [hm_getmark points 1];
foreach LineId $LineList {
foreach PointId $PointList {
*linesplitatpoint $PointId 1;
}
}

this code has some error, Please help me to Fix this code.

Thank You

 

Find more posts tagged with

Sort by:
1 - 4 of 41
    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    Can not help with "some error". Could you show all error message here?

    User: "RajeshSRSamsung"
    Altair Community Member
    OP
    Updated by RajeshSRSamsung

    Thank You Nguyen-Dai.

    The error message i got is as shown below.

    ----------------------------------------------------------------------------------

    0

    0

    while executing
    "*linesplitatpoint $PointId 1"
    ("foreach" body line 2)
    invoked from within
    "foreach PointId $PointList {
    *linesplitatpoint $PointId 1;
    }"
    ("foreach" body line 2)
    invoked from within
    "foreach LineId $LineList {
    foreach PointId $PointList {
    *linesplitatpoint $PointId 1;
    }
    }"

    (file "C:/Users/userid/Desktop/hypermeshmacro/linesplit.tcl" line 5)
    invoked from within
    "source {C:/Users/userid/Desktop/hypermeshmacro/linesplit.tcl}"
    ("uplevel" body line 1)
    invoked from within
    "uplevel #0 "source {$file}""
    (procedure "::HM_Framework::p_FileLoad" line 68)
    invoked from within
    "::HM_Framework::p_FileLoad 24"
    (menu invoke)

    -----------------------------------------------------------------------------------

    User: "RajeshSRSamsung"
    Altair Community Member
    OP
    Updated by RajeshSRSamsung

    Hi

    while checking the command tcl file, i found that *linesplitatpoint is first making a node at the point and then dividing the line at the node.

    so i modified the program and model as below.

    In the model i made nodes at the intersection of line instead of points.

    image

    and in tcl script i used the nodeid.

    *createmark lines 1 "displayed";
    *createmark nodes 1 "displayed";
    set LineList [hm_getmark lines 1];
    set NodeList [hm_getmark nodes 1];
    foreach LineId $LineList {
    foreach NodeId $NodeList {
    *linesplitatpoint $LineId $NodeId;
    }
    }

    only line 1 is split and then the program stop with the following error message.

    -----------------------------------------------------------------------------------------

    0
    0
    while executing
    "*linesplitatpoint $LineId $NodeId"
    ("foreach" body line 2)
    invoked from within
    "foreach NodeId $NodeList {
    *linesplitatpoint $LineId $NodeId;
    }"
    ("foreach" body line 2)
    invoked from within
    "foreach LineId $LineList {
    foreach NodeId $NodeList {
    *linesplitatpoint $LineId $NodeId;
    }
    }"
    (file "C:/Users/userid/Desktop/hypermeshmacro/linesplit.tcl" line 5)
    invoked from within
    "source {C:/Users/userid/Desktop/hypermeshmacro/linesplit.tcl}"
    ("uplevel" body line 1)
    invoked from within
    "uplevel #0 "source {$file}""
    (procedure "::HM_Framework::p_FileLoad" line 68)
    invoked from within
    "::HM_Framework::p_FileLoad 24"
    (menu invoke)

    -------------------------------------------------------------------------------------------

    Thank You

    User: "RajeshSRSamsung"
    Altair Community Member
    OP
    Updated by RajeshSRSamsung

    Hi, 

    Please see the sample HM file attached. Thank You