Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

IndicateOrSelectElement2D

Status
Not open for further replies.

sbmjpb

Mechanical
Aug 22, 2013
12
hi everybody,

I have a problem with this command whose worked with catia v5-r20 but it seems that with catia v5-6 r2013, this command has changed.
in the past, user can indicate a point at screen or selected a 2dpoint in a document and now user can only select a 2dpoint.
i try the code sample in visual basic help but it doesn't work.
someone has an idea??
 
Replies continue below

Recommended for you

your query is not clear. Please explain your requirement clearly.
 
Hi,

I don't have access to latest releases but I saw in documentation:

On line help docs said:
Runs an interactive command enabling both indication and selection, 2D version.
Role: IndicateOrSelectElement2D asks the end user to select either a location into the window, or a feature (in the geometry or in the specification tree).
During execution, when entering this method, the active editor must be in 2D.
Note: The method (and script execution) fails if one of the following error occurs:
CATIA.ScriptCommand is equal to CatScriptCommandDefault. Selection.IndicateOrSelectElement2D cannot be called.
CATIA.ScriptCommand is equal to CatScriptCommandStop. Selection.IndicateOrSelectElement2D cannot be called.

If is not working correct (and you are sure about that) you can open a bug report, providing to DS all details and scenario.

Regards
Fernando

 
my query concern a vba command "IndicateOrSelectElement2d"
In the past we have already used this command through a vba program and it worked perfectly and after installation of new release of catia (v5 r23 sp2) the program doesn't worked anymore.
I isolate the problem (IndicateOrSelectElement2d) and try to use the command in other context.
I take the sample on vba automation but it doesn't work so I call catia hotline and he seems that it works with catia v5 r23 sp3 but not with sp2.

Dim Document,Selection,DrawingSheets,DrawingSheet,DrawingViews,WindowLocation(1),DrawingView,Factory2D,Radius,Circle2D
Dim HardCodedPoint,Status,XCenter,YCenter,InputObjectType(0),TempCircleHasBeenCreatedAtLeastOnce,ExistingPoint
Dim ObjectSelected
Set Document = CATIA.ActiveDocument : Set Selection = Document.Selection : Set DrawingSheets = Document.Sheets
Set DrawingSheet = DrawingSheets.ActiveSheet : Set DrawingViews = DrawingSheet.Views
Set DrawingView = DrawingViews.ActiveView : Set Factory2D = DrawingView.Factory2D

Set HardCodedPoint = Factory2D.CreatePoint(700.,400.)
HardCodedPoint.ReportName = 1 : HardCodedPoint.Construction = False

Status=Document.Indicate2D("click to define the circle center",WindowLocation)
if (Status = "Cancel" Or Status = "Undo" Or Status = "Redo") then Exit Sub
XCenter = WindowLocation(0) : YCenter = WindowLocation(1)

InputObjectType(0)="Point2D"
Status = "MouseMove" : TempCircleHasBeenCreatedAtLeastOnce = 0
Status=Selection.IndicateOrSelectElement2D("select a point or click to locate the circle radius point", _
InputObjectType,false,false,true, _
ObjectSelected,WindowLocation)

do while (Status = "MouseMove")
if (TempCircleHasBeenCreatedAtLeastOnce) then
Selection.Add Circle2D : Selection.Delete
end if
Radius = Sqr(((WindowLocation(0)-XCenter)*(WindowLocation(0)-XCenter))+ _
((WindowLocation(1)-YCenter)*(WindowLocation(1)-YCenter)))
Set Circle2D = Factory2D.CreateClosedCircle(XCenter,YCenter,Radius)
TempCircleHasBeenCreatedAtLeastOnce = 1
Status=Selection.IndicateOrSelectElement2D("select a point or click to locate the circle radius point", _
InputObjectType,false,false,true, _
ObjectSelected,WindowLocation)
loop

if (Status = "Cancel" Or Status = "Undo" Or Status = "Redo") then
if (TempCircleHasBeenCreatedAtLeastOnce) then
Selection.Add Circle2D : Selection.Add HardCodedPoint : Selection.Delete
end if
Exit Sub
end if

if (ObjectSelected) then
Set ExistingPoint = Selection.Item2(1).Value : ExistingPoint.GetCoordinates WindowLocation : Selection.Clear
end if

if (TempCircleHasBeenCreatedAtLeastOnce) then
Selection.Add Circle2D : Selection.Delete
end if

Radius = Sqr(((WindowLocation(0)-XCenter)*(WindowLocation(0)-XCenter))+ _
((WindowLocation(1)-YCenter)*(WindowLocation(1)-YCenter)))
Set Circle2D = Factory2D.CreateClosedCircle(XCenter,YCenter,Radius) : Selection.Add Circle2D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor