×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

IndicateOrSelectElement2D

IndicateOrSelectElement2D

IndicateOrSelectElement2D

(OP)
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??

RE: IndicateOrSelectElement2D

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

RE: IndicateOrSelectElement2D

Hi,

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

Quote (On line help docs)


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

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: IndicateOrSelectElement2D

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources