gauravd1991
Mechanical
Hi
I am new to this forum, and some help on a problem would be great.
I was thinking of creating a macro to check for duplicate dimensions across different views in a drawing file.
I have never used VB scripting before. But, I have written the equivalent code in C++ (which i am familiar with)
Now, I want to read dimensions from a drawing file, and put it in a file from where i can use the following algorithm.
I think it is possible, i just don't know how. The C++ algorithm is below:
#include<iostream>
#include<conio.h>
#include<stdio.h>
void clear_screen()
{
int i;
for(i=0;i<100;i++)
std::cout<<"\n";
}
using namespace std;
int main()
{
clear_screen();
int no_views, dim_max;
float dims[10][100];
int counter,ctr, ctr1;
std::cout<<"Enter total no. of views in drawing sheets\n";
std::cin>>no_views;
std::cout<<" out of all the views, please enter the number of dimensions in the view with the most dimensions\n";
std::cin>>dim_max;
std::cout<<"start entering dims. view wise\n";
for(ctr=0;ctr<no_views;ctr++)
{ ctr1=ctr+1;
std::cout<<"enter dimesnsion for view: "<<ctr1<<"\n";
for(counter=0;counter<dim_max;counter++)
std::cin>>dims[ctr][counter];
}
//output check
std::cout<<dims[0][3]<<"\n\n";
std::cout<<"entered dims as follows\n";
for(ctr=0;ctr<no_views;ctr++)
{
for(counter=0;counter<dim_max;counter++)
std::cout<<dims[ctr][counter]<<"\t";
std::cout<<"\n";
}
if(no_views<=1)
std::cout<<"No comparison needed\n";
else
{
/* Somehow, we have to get inputs of the dimensions from all views in VBA and store in array dims */
int i,j,k,dj;
j=no_views-1; dj;
int dim;
do
{
dj=0;
do
{
/*cout<<"view no "<<(dj+1)<<"\nenter total no of dimensions in current view:\n";
cin>>dim_max;
*/
for(k=j-1;k>=0;k--)
{
for(dim=0;dim<=dim_max;dim++)
{
if( (dims[j][dj]==dims[k][dim])&&(dims[j][dj]!=0))
std::cout<<"following dimension repeated, check!: "<< dims[k][dim]<<" view number: "<<(j+1)<<"\n";
else
std::cout<<"not repeated yet\n";
} //end of inner for loop
} //end of outer for loop
dj++;
} while (dj<dim_max);
j--;
}while(j>0);
}
getch();
return 0;
}
Any ideas?
I am new to this forum, and some help on a problem would be great.
I was thinking of creating a macro to check for duplicate dimensions across different views in a drawing file.
I have never used VB scripting before. But, I have written the equivalent code in C++ (which i am familiar with)
Now, I want to read dimensions from a drawing file, and put it in a file from where i can use the following algorithm.
I think it is possible, i just don't know how. The C++ algorithm is below:
#include<iostream>
#include<conio.h>
#include<stdio.h>
void clear_screen()
{
int i;
for(i=0;i<100;i++)
std::cout<<"\n";
}
using namespace std;
int main()
{
clear_screen();
int no_views, dim_max;
float dims[10][100];
int counter,ctr, ctr1;
std::cout<<"Enter total no. of views in drawing sheets\n";
std::cin>>no_views;
std::cout<<" out of all the views, please enter the number of dimensions in the view with the most dimensions\n";
std::cin>>dim_max;
std::cout<<"start entering dims. view wise\n";
for(ctr=0;ctr<no_views;ctr++)
{ ctr1=ctr+1;
std::cout<<"enter dimesnsion for view: "<<ctr1<<"\n";
for(counter=0;counter<dim_max;counter++)
std::cin>>dims[ctr][counter];
}
//output check
std::cout<<dims[0][3]<<"\n\n";
std::cout<<"entered dims as follows\n";
for(ctr=0;ctr<no_views;ctr++)
{
for(counter=0;counter<dim_max;counter++)
std::cout<<dims[ctr][counter]<<"\t";
std::cout<<"\n";
}
if(no_views<=1)
std::cout<<"No comparison needed\n";
else
{
/* Somehow, we have to get inputs of the dimensions from all views in VBA and store in array dims */
int i,j,k,dj;
j=no_views-1; dj;
int dim;
do
{
dj=0;
do
{
/*cout<<"view no "<<(dj+1)<<"\nenter total no of dimensions in current view:\n";
cin>>dim_max;
*/
for(k=j-1;k>=0;k--)
{
for(dim=0;dim<=dim_max;dim++)
{
if( (dims[j][dj]==dims[k][dim])&&(dims[j][dj]!=0))
std::cout<<"following dimension repeated, check!: "<< dims[k][dim]<<" view number: "<<(j+1)<<"\n";
else
std::cout<<"not repeated yet\n";
} //end of inner for loop
} //end of outer for loop
dj++;
} while (dj<dim_max);
j--;
}while(j>0);
}
getch();
return 0;
}
Any ideas?