![]() Long before our designs are dimensioned and annotated, we’re retrieving or verifying things like distances, radius, and angles or even areas and volumes.Īnd, just like your designs evolve, so have AutoCAD’s methods to retrieve this information. MinimumDistance = TheMeasurable.We’re querying our drawings for geometric information all the time. Set reference2 = SelectedElement2 'hybridShapes1.Item("MyEndPt2") Set reference1 = SelectedElement1 ‘hybridShapes1.Item(“MyEndPt1”) <-– Error here MsgBox “Select the second Reference Point” OStatus = sel.SelectElement2(rPoint, “Select a Reference Point”, True) MsgBox “Select the first Reference Point” Could you please help me find what I am doing wrong? Below is my codes. I would like to measure the distance btw two selected points, but I am not able to make it work. Thank you for the example codes and detailed explanations of how they work. I would appreciate it if you could give me an example. The purpose of the above purpose is to create a point on the curve by dividing it by the distance between the ends of both curves in one curve for use in creating a ‘Fastner location’. In ‘3D EXPERIENCE’, I would be grateful if you could tell me how to apply it. Set formula1 = relations1.CreateFormula (“Formula.2”, “”, length1, “lengthg (` macro generation curve`, `macro generation point 1`,` macro generation point 2`) ![]() Set length1 = parameters1.CreateDimension (“”, “LENGTH”, 0) The macro used is length (curve, point, point) Generating points using macros rather than generated points Is there a parameter and relations method that measures the distance of the points created? I have some inquiries about the above macros and leave a comment. I am an engineer who is designing an airplane. To determine the ID of a workbench, open a workbench and the script that can be downloaded here.There’s also a list of workbench IDs in the latest edition of VB Scripting for CATIA V5 here. The GetWorkbench command takes a string as an argument and returns a Workbench object. Set reference2 = hybridShapes1.Item("MyEndPt2") 'if code not working properly use msgbox to check reference name Set reference1 = hybridShapes1.Item("MyEndPt1") MinimumDistance = TheMeasurable.GetMinimumDistance(reference2) Set TheMeasurable = TheSPAWorkbench.GetMeasurable(reference1) 'built in check if needed 'MsgBox ("ref2=" & reference2.Name) 'get the SPAworkbench Dim TheSPAWorkbench As Workbench Set reference2 = hybridShapes1.Item( "MyEndPt2") 'if code not working properly use msgbox to check reference name 'MsgBox ("ref1=" & reference1.Name) Dim reference2 As Reference Set reference1 = hybridShapes1.Item( "MyEndPt1") Set hybridShapes1 = hybridBody1.HybridShapes ![]() 'active document must be a CATPart Dim documents1 As Documents For example, you can change it to measure a point to a plane by changing this line of code: This code can be used to measure between more than just two points. Notice the parameter and relation that were created automatically (the measure between shown was created manually to double check the macro worked properly): Msgbox "The endpoints are " & length1.ValueAsString & " apart." 'display the distance the endpoints are apart in a messagebox Set formula1 = relations1.CreateFormula("Formula.2", "", length1, "distance(`Geometrical Set.1\MyEndPt1` ,`Geometrical Set.1\MyEndPt2` ) ") 'make sure points are labeled MyEndPt1 and MyEndPt2 respectively 'create a new formula to link to the parameter Set length1 = parameters1.CreateDimension("", "LENGTH", 0.000000) 'create a new length type parameter, set its value to 0 for now Msgbox "The endpoints are " & length1.ValueAsString & " apart." End Sub Set formula1 = relations1.CreateFormula( "Formula.2", "", length1, "distance(`Geometrical Set.1\MyEndPt1` ,`Geometrical Set.1\MyEndPt2` ) ")įormula1.Rename "Distance" 'display the distance the endpoints are apart in a messagebox 'make sure points are labeled MyEndPt1 and MyEndPt2 respectively Dim formula1 As Formula Length1.Rename "MeasureDistance" 'create a new formula to link to the parameter Dim relations1 As Relations Set length1 = parameters1.CreateDimension( "", "LENGTH", 0.000000) 'create a new length type parameter, set its value to 0 for now Dim length1 As Dimension 'active document is a single part file Dim partDocument1 As Document 'this macro creates a parameter and relation to measure the distance between two points
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |