Co-ords as a label
Co-ords as a label
Need to know if there is a simple function, to label a point with the co-ords (x, y and z) for that particular point
-
- 12d Support
- Posts: 310
- Joined: Thu Apr 05, 2007 2:46 pm
Hi,
I see you are posting this in the Practice Version forum.
In V9 you can run the Strings > Label Vertices option twice to get the x coord and y coord labelled.
In Version 10 you can use the Drafting > Text and Tables >Information Leader to very quickly place a leader arrow and label the x,y or x,y,z coordinates of a point.
Dylan
I see you are posting this in the Practice Version forum.
In V9 you can run the Strings > Label Vertices option twice to get the x coord and y coord labelled.
In Version 10 you can use the Drafting > Text and Tables >Information Leader to very quickly place a leader arrow and label the x,y or x,y,z coordinates of a point.
Dylan
-
- Posts: 381
- Joined: Fri Oct 21, 2005 9:24 am
i have a macro that creates x, y, z, names or ID
its a very good macro, but i cant remember where i got it from. may have been in the forum macro database. thank you to whoever wrote this.
here is the code you can copy to a .4dm file and compile.
daz
#include "set_ups.H"
#include "standard_library.H"
void manage_a_panel()
// ----------------------------------------------------------
// ----------------------------------------------------------
{
// create the panel
Panel panel = Create_panel("Label Vertices w");
Vertical_Group vgroup = Create_vertical_group(-1); Set_border(vgroup ," ");
Message_Box message = Create_message_box(" ");
//-----------------------------------------------------------------------------------------------------
Source_Box source_box = Create_source_box("to Label",message,Source_Box_All | Source_Box_Standard);
Append(source_box ,vgroup);
Textstyle_Data_Box text_data_box3 = Create_textstyle_data_box("TextStyle",message,Show_std_boxes);
Textstyle_Data textdata3;
Set_textstyle(textdata3,"Garrison Sans");
Set_colour (textdata3, 2); Set_text_type(textdata3,2);
Set_size (textdata3,2);
Set_offset (textdata3,1.5);
Set_raise (textdata3,1.5);
Set_data(text_data_box3,textdata3);
Append(text_data_box3,vgroup);
Vertical_Group deflt_grp = Create_vertical_group(1); Set_border(deflt_grp ," Label : ");
//--------------------------------------------------------------
Named_Tick_Box lblname_box2 = Create_named_tick_box("ID ",1," ");
Append(lblname_box2,deflt_grp);
Named_Tick_Box lblname_box3 = Create_named_tick_box("Name",1," ");
Append(lblname_box3,deflt_grp);
Vertical_Group deflt_grp2 = Create_vertical_group(-1); Set_border(deflt_grp ," Label : ");
Named_Tick_Box lblname_box4 = Create_named_tick_box("X ",0," ");
Append(lblname_box4,deflt_grp2);
Named_Tick_Box lblname_box5 = Create_named_tick_box("Y ",0," ");
Append(lblname_box5,deflt_grp2);
Named_Tick_Box lblname_box6 = Create_named_tick_box("Z ",1," ");
Append(lblname_box6,deflt_grp2);
Integer_Box decint_box4 = Create_integer_box("Num dec places",message);
Set_data(decint_box4,3);
Append(decint_box4 ,deflt_grp2);
Append(deflt_grp2,deflt_grp);
/*
Named_Tick_Box lblname_box7 = Create_named_tick_box("attribute",0," ");
Append(lblname_box7,deflt_grp);
Input_Box att_name = Create_input_box("att name",message);
Append(att_name,deflt_grp);
*/
Append(deflt_grp,vgroup);
// -------------- model -----------------------------------
Model_Box Mod_box1;
switch ("c") {
case "c" : {
Mod_box1 = Create_model_box("Model for Labels",message,CHECK_MODEL_CREATE);
} break;
case "e" : {
Mod_box1 = Create_model_box("Model for Labels",message,CHECK_MODEL_EXISTS);
} break;
case "me" : {
Mod_box1 = Create_model_box("Model for Labels",message,CHECK_MODEL_MUST_EXIST);
} break;
}
Append(Mod_box1,vgroup);
//--------------------------------------------------------------
// buttons along the bottom
Horizontal_Group bgroup = Create_button_group();
Button process = Create_button("&Label","count");
Button finish = Create_button("&Finish" ,"finish");
Append(process,bgroup);
Append(finish ,bgroup);
Append(message,vgroup);
Append(bgroup ,vgroup);
Append( vgroup ,panel);
// -----------------------------------------------------------
Text pptext;
Integer page;
Show_widget(panel);
Integer doit = 1;
while(doit) {
Integer id;
Text cmd;
Text msg;
Integer ret = Wait_on_widgets(id,cmd,msg);
if(cmd == "keystroke") continue;
switch(id) {
case Get_id(panel) : {
if(cmd == "Panel Quit") doit = 0;
} break;
case Get_id(finish) : {
if(cmd == "finish") doit = 0;
} break;
case Get_id(process) : {
Uid start_id = Get_next_uid();
// ----------------------- Validate tick boxes -------------------------------------
Integer tickbox2,tickbox3,tickbox4,tickbox5,tickbox6,tickbox7 ;
Validate(lblname_box2,tickbox2);
Validate(lblname_box3,tickbox3);
Validate(lblname_box4,tickbox4);
Validate(lblname_box5,tickbox5);
Validate(lblname_box6,tickbox6);
// --------------- Validate Textstyle boxes -------------------------------------------------
Textstyle_Data settextdata3;
Validate(text_data_box3,settextdata3);
// --------------- Validate Decimal boxes -------------------------------------------------
Integer decpl;
Validate(decint_box4,decpl );
// --------------- Validate Model boxes -------------------------------------------------
Model mod1 ;
Integer err = Validate(Mod_box1,GET_MODEL_CREATE,mod1);
if(err != MODEL_EXISTS) break;
// --------------- Get Elements -------------------------------------------------
Integer ierr;
Dynamic_Element elt;
ierr = Validate(source_box,elt);
if(ierr != TRUE) {
Set_data(message,"Invalid source choices");
break;
}
Integer no_items=0;
Element string;
// --------------- process Elements and create text -------------------------------------------------
Text user;
Get_user_name(user);
Get_number_of_items(elt,no_items);
for(Integer i=1;i<=no_items;i++) {
Get_item(elt,i,string);
Integer numpts=0;
Get_points(string,numpts);
Text strname;
Get_name(string,strname);
Text datetime;
Time(datetime);
for(Integer j=1;j<=numpts;j++) {
Real x1,y1,z1;
Get_data(string,j,x1,y1,z1);
Text vrtid;
Get_super_vertex_point_number (string,j,vrtid);
Text label_text;
if( tickbox2 == 1 ) {
label_text = vrtid;
}
if( tickbox3 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = strname ;
}else {
label_text = label_text + "\\n" + strname ;
}
}
if( tickbox4 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = To_text(x1,decpl);
}else {
label_text = label_text + "\\n" + To_text(x1,decpl) ;
}
}
if( tickbox5 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = To_text(y1,decpl);
}else {
label_text = label_text + "\\n" + To_text(y1,decpl) ;
}
}
if( tickbox6 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = To_text(z1,decpl);
}else {
Integer zerr = Is_null(z1);
if( zerr == 0 ) { label_text = label_text + "\\n" + To_text(z1,decpl) ; }
}
}
Element idelt = Create_text( label_text , x1,y1, 1, 1,0,1,1,0 ,0);
Set_text_textstyle_data(idelt,settextdata3);
Integer colrs;
Get_colour (settextdata3,colrs);
Set_colour(idelt,colrs);
Set_name(idelt,strname);
Set_attribute(idelt,"Created by",user); Set_attribute(idelt,"Created at",datetime);
Calc_extent(idelt);
Set_model(idelt,mod1);
} // for j
} // for i
Set_data(message, "Labels DONE! " );
Uid end_id = Get_last_uid();
Add_undo_range("Label Vertex BMs",start_id,end_id);
Null(elt);
} break;
}
}
}
void main()
//---------------------------------------------------------
//
//---------------------------------------------------------
{
manage_a_panel();
}
its a very good macro, but i cant remember where i got it from. may have been in the forum macro database. thank you to whoever wrote this.
here is the code you can copy to a .4dm file and compile.
daz
#include "set_ups.H"
#include "standard_library.H"
void manage_a_panel()
// ----------------------------------------------------------
// ----------------------------------------------------------
{
// create the panel
Panel panel = Create_panel("Label Vertices w");
Vertical_Group vgroup = Create_vertical_group(-1); Set_border(vgroup ," ");
Message_Box message = Create_message_box(" ");
//-----------------------------------------------------------------------------------------------------
Source_Box source_box = Create_source_box("to Label",message,Source_Box_All | Source_Box_Standard);
Append(source_box ,vgroup);
Textstyle_Data_Box text_data_box3 = Create_textstyle_data_box("TextStyle",message,Show_std_boxes);
Textstyle_Data textdata3;
Set_textstyle(textdata3,"Garrison Sans");
Set_colour (textdata3, 2); Set_text_type(textdata3,2);
Set_size (textdata3,2);
Set_offset (textdata3,1.5);
Set_raise (textdata3,1.5);
Set_data(text_data_box3,textdata3);
Append(text_data_box3,vgroup);
Vertical_Group deflt_grp = Create_vertical_group(1); Set_border(deflt_grp ," Label : ");
//--------------------------------------------------------------
Named_Tick_Box lblname_box2 = Create_named_tick_box("ID ",1," ");
Append(lblname_box2,deflt_grp);
Named_Tick_Box lblname_box3 = Create_named_tick_box("Name",1," ");
Append(lblname_box3,deflt_grp);
Vertical_Group deflt_grp2 = Create_vertical_group(-1); Set_border(deflt_grp ," Label : ");
Named_Tick_Box lblname_box4 = Create_named_tick_box("X ",0," ");
Append(lblname_box4,deflt_grp2);
Named_Tick_Box lblname_box5 = Create_named_tick_box("Y ",0," ");
Append(lblname_box5,deflt_grp2);
Named_Tick_Box lblname_box6 = Create_named_tick_box("Z ",1," ");
Append(lblname_box6,deflt_grp2);
Integer_Box decint_box4 = Create_integer_box("Num dec places",message);
Set_data(decint_box4,3);
Append(decint_box4 ,deflt_grp2);
Append(deflt_grp2,deflt_grp);
/*
Named_Tick_Box lblname_box7 = Create_named_tick_box("attribute",0," ");
Append(lblname_box7,deflt_grp);
Input_Box att_name = Create_input_box("att name",message);
Append(att_name,deflt_grp);
*/
Append(deflt_grp,vgroup);
// -------------- model -----------------------------------
Model_Box Mod_box1;
switch ("c") {
case "c" : {
Mod_box1 = Create_model_box("Model for Labels",message,CHECK_MODEL_CREATE);
} break;
case "e" : {
Mod_box1 = Create_model_box("Model for Labels",message,CHECK_MODEL_EXISTS);
} break;
case "me" : {
Mod_box1 = Create_model_box("Model for Labels",message,CHECK_MODEL_MUST_EXIST);
} break;
}
Append(Mod_box1,vgroup);
//--------------------------------------------------------------
// buttons along the bottom
Horizontal_Group bgroup = Create_button_group();
Button process = Create_button("&Label","count");
Button finish = Create_button("&Finish" ,"finish");
Append(process,bgroup);
Append(finish ,bgroup);
Append(message,vgroup);
Append(bgroup ,vgroup);
Append( vgroup ,panel);
// -----------------------------------------------------------
Text pptext;
Integer page;
Show_widget(panel);
Integer doit = 1;
while(doit) {
Integer id;
Text cmd;
Text msg;
Integer ret = Wait_on_widgets(id,cmd,msg);
if(cmd == "keystroke") continue;
switch(id) {
case Get_id(panel) : {
if(cmd == "Panel Quit") doit = 0;
} break;
case Get_id(finish) : {
if(cmd == "finish") doit = 0;
} break;
case Get_id(process) : {
Uid start_id = Get_next_uid();
// ----------------------- Validate tick boxes -------------------------------------
Integer tickbox2,tickbox3,tickbox4,tickbox5,tickbox6,tickbox7 ;
Validate(lblname_box2,tickbox2);
Validate(lblname_box3,tickbox3);
Validate(lblname_box4,tickbox4);
Validate(lblname_box5,tickbox5);
Validate(lblname_box6,tickbox6);
// --------------- Validate Textstyle boxes -------------------------------------------------
Textstyle_Data settextdata3;
Validate(text_data_box3,settextdata3);
// --------------- Validate Decimal boxes -------------------------------------------------
Integer decpl;
Validate(decint_box4,decpl );
// --------------- Validate Model boxes -------------------------------------------------
Model mod1 ;
Integer err = Validate(Mod_box1,GET_MODEL_CREATE,mod1);
if(err != MODEL_EXISTS) break;
// --------------- Get Elements -------------------------------------------------
Integer ierr;
Dynamic_Element elt;
ierr = Validate(source_box,elt);
if(ierr != TRUE) {
Set_data(message,"Invalid source choices");
break;
}
Integer no_items=0;
Element string;
// --------------- process Elements and create text -------------------------------------------------
Text user;
Get_user_name(user);
Get_number_of_items(elt,no_items);
for(Integer i=1;i<=no_items;i++) {
Get_item(elt,i,string);
Integer numpts=0;
Get_points(string,numpts);
Text strname;
Get_name(string,strname);
Text datetime;
Time(datetime);
for(Integer j=1;j<=numpts;j++) {
Real x1,y1,z1;
Get_data(string,j,x1,y1,z1);
Text vrtid;
Get_super_vertex_point_number (string,j,vrtid);
Text label_text;
if( tickbox2 == 1 ) {
label_text = vrtid;
}
if( tickbox3 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = strname ;
}else {
label_text = label_text + "\\n" + strname ;
}
}
if( tickbox4 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = To_text(x1,decpl);
}else {
label_text = label_text + "\\n" + To_text(x1,decpl) ;
}
}
if( tickbox5 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = To_text(y1,decpl);
}else {
label_text = label_text + "\\n" + To_text(y1,decpl) ;
}
}
if( tickbox6 == 1 ) {
if ( label_text == "" | label_text == " " ) {
label_text = To_text(z1,decpl);
}else {
Integer zerr = Is_null(z1);
if( zerr == 0 ) { label_text = label_text + "\\n" + To_text(z1,decpl) ; }
}
}
Element idelt = Create_text( label_text , x1,y1, 1, 1,0,1,1,0 ,0);
Set_text_textstyle_data(idelt,settextdata3);
Integer colrs;
Get_colour (settextdata3,colrs);
Set_colour(idelt,colrs);
Set_name(idelt,strname);
Set_attribute(idelt,"Created by",user); Set_attribute(idelt,"Created at",datetime);
Calc_extent(idelt);
Set_model(idelt,mod1);
} // for j
} // for i
Set_data(message, "Labels DONE! " );
Uid end_id = Get_last_uid();
Add_undo_range("Label Vertex BMs",start_id,end_id);
Null(elt);
} break;
}
}
}
void main()
//---------------------------------------------------------
//
//---------------------------------------------------------
{
manage_a_panel();
}
-
- 12d Support
- Posts: 310
- Joined: Thu Apr 05, 2007 2:46 pm
Once you run an info leader in a project, a file called Info_Leader_Create_Panel is created in the .project folder.
You can edit this in a text editor and change the default decimal places for results and other settings.
If you want to use this on all your projects you can copy this file into your User Library.
Dylan
You can edit this in a text editor and change the default decimal places for results and other settings.
If you want to use this on all your projects you can copy this file into your User Library.
Dylan
-
- Posts: 11
- Joined: Tue Jun 11, 2013 12:22 pm
-
- 12d Support
- Posts: 310
- Joined: Thu Apr 05, 2007 2:46 pm
-
- Posts: 86
- Joined: Thu Jan 12, 2006 12:43 pm
-
- Posts: 1745
- Joined: Fri Oct 21, 2005 8:47 am
-
- Posts: 381
- Joined: Fri Oct 21, 2005 9:24 am
i have gone through many posts and have found the source of the source code.
it is Sam Cech of course and the link to this post is below. the title of the post is "
Putting xyz Co-ords on screen" in the design section of the forum.. the link below should get to it as i found it though the search section.
http://forums.12dmodel.com/viewtopic.ph ... ox3+vgroup
its three pages long and has additional info about SA co ords, etc.
mick, scott
i know the macro worked in V9, havent used in V10. may have to discuss the new errors with Master Sam to resolve.
i can read the code, but dont understand it much.
at least i have found the source for you all to devour and recreate a V10 / V11 macro.
daz
it is Sam Cech of course and the link to this post is below. the title of the post is "
Putting xyz Co-ords on screen" in the design section of the forum.. the link below should get to it as i found it though the search section.
http://forums.12dmodel.com/viewtopic.ph ... ox3+vgroup
its three pages long and has additional info about SA co ords, etc.
mick, scott
i know the macro worked in V9, havent used in V10. may have to discuss the new errors with Master Sam to resolve.
i can read the code, but dont understand it much.
at least i have found the source for you all to devour and recreate a V10 / V11 macro.
daz
-
- Posts: 3175
- Joined: Fri Oct 21, 2005 2:46 pm
-
- Posts: 86
- Joined: Thu Jan 12, 2006 12:43 pm