trying to create a macro in IMInspect

Started by horsetooth, August 04, 2009, 12:28:06 AM

Previous topic - Next topic

horsetooth

We want to create a macro. Our problem is that we do not get the loop done.  ???
We have created a series of points. We want to create vectors between these points from
1 to the end and then back from the last point back to the first. The number of points will
vary from model to model.
Then we want to measure the angle between the vector and a plane that we created before manuelly.
The support has adviced us to do that with a while-loop. But we seem not to get it done.
Can anybody help us?

Admin

Here is a macro that will work to create vectors from the points like you asked.  The only restriction is that the points have to be features and that there cannot be any other features in the tree for it to work properly.  If you need the macro to identify the points in the tree, it will be more complicated.  I would consider running this first before you create your plane and they you can run a similar macro to create your angle measurements between the vectors and the planes.  If you would give some more details to what is specifically in your feature tree, then I could help more, but this is all I could do without spending a bunch of time.  I hope this helps to get you going.  Feel free to add some screenshots of what your tree looks like when you want to run the macro and exactly the output of the macro you need.

Quote

version "4.0"

DECLARE nb_points
DECLARE point_name
DECLARE iter 1
DECLARE starting_point
DECLARE ending_point

#This assumes that the points are features and that there are only points in the feature list. 
#If there are more features this will not work and the macro will have to be more complex to identify which ones are the points
#Get the number of points in the feature list
TREEVIEW FEATURE GET_NB (nb_points)

#Create a duplicate of the first point so that the last vector goes from the last point back to the first. 
#If we did not do this, the vector would point from the first to the last.
TREEVIEW SELECT NONE
TREEVIEW FEATURE SELECT (1,"On")
EDIT OBJECT DUPLICATE ()

#While loop to create vectors
WHILE $iter <= $nb_points
   
    SET starting_point $iter
    SET ending_point expr($iter+1)     
    TREEVIEW SELECT NONE
    TREEVIEW FEATURE SELECT ($starting_point,"On")
    TREEVIEW FEATURE SELECT ($ending_point,"On")
    FEATURE PRIMITIVE VECTOR FROM_CENTER_POINTS ("vector $iter",)
   
    #add one to the iteration
    ++ iter
ENDWHILE

TREEVIEW SELECT NONE
TREEVIEW FEATURE SELECT ($iter, "On")
EDIT OBJECT DELETE
TREEVIEW SELECT NONE

MACRO PAUSE ("End", "Macro Complete")



horsetooth

Hello,
thank you for your immediate response. It was very helpful. There is no problem with additionally features in the treeview (e.g. planes and curves). The programm just ignores them and runs further until the end. We try to finish the macro on our own now. But if we do not make it, we might come back to you.

Cheers.

horsetooth

Hello again,

we have a problem. We want to export our measurment, that was created with a macro in IMInspect, to an excel sheet. We want the excel sheet to be saved automatically. How is the command structure for saving an excel sheet?
Is it possible to import selected objects from IMEdit to IMInspect automatically?

Cheers.

Admin

Try using the HTML Command Reference to search for EXPORT or EXCEL and I think you will have some success. It is found under the Help Menu in the Macro Script Editor window.  I am pretty sure that the commands included in the reference are only applicable to the module (IMEdit vs IMInspect) that you open the reference guide from.