split a group of lines using points in the model
Hi,
I have a model of lines.
I made point at the crossing location of lines using the option
and finally the model is as shown below.
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
Answers
-
Can not help with "some error". Could you show all error message here?
0 -
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)-----------------------------------------------------------------------------------
0 -
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.
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
0 -