×
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!

*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

Spline thru isolated points

Spline thru isolated points

Spline thru isolated points

(OP)
Hi everyone, I am new to this forum and i have a small problem which i am not able to solve by my self.
The thing is that when we recived points from our customer they are mostly isolated and thru that points we are making spline so we could sweep the profile.
Every time we need manualy to make point as a coordinate type and we have more then 50 points so it take a lot of time.
I even tried to export points to excel and then to imort them to Catia bit it take a lot of time. So does anyone have any idea how to combine these 2 macros in 1, or someone have some other solution
I've searched the forum and there is nothing similar like this, so i would really appritiate any help

RE: Spline thru isolated points

You can build spline from isolated points just fine.


It's possible to create a spline with macro, but how would one define a proper order of points?

RE: Spline thru isolated points

(OP)
Hi thanks for the anwer but, from time to time we beed to changde the coordinates of these points. Making a spline it is not a problem, but converting these points in coordinate type it is a problem

RE: Spline thru isolated points

To "move" datum point create new point with reference to the datum and use this point in your spline.

RE: Spline thru isolated points

(OP)
Is there any macro for that. Because we have more then 30 points to move manualy?

RE: Spline thru isolated points

I've no idea if there is, it can be written easily.

How do you determine when you need to move a point? Where should new offset point be located?

RE: Spline thru isolated points

(OP)
I will try to explane. We have a tube thru the all car and thru that tube we have some fluid that need to be tranfered and path is depend from a body of the car. Very offten we need to change the position of some parts due to customer requirenmants. So then we need to change position of some points to fit the postition of the body on the car

RE: Spline thru isolated points

Ok, here is a snippet that creates editable versions of all isolated points in a body/geoset:

CODE

Sub CATMain()
  Dim sel: set sel = CATIA.ActiveDocument.Selection
  if "Normal" <> sel.SelectElement(Array("HybridBody", "Body"), "Select geometrical set or body containing isolated points", True) then
    exit sub
  end if

  Dim container: set container = sel.Item(1).Value
  Dim prt: set prt = CATIA.ActiveDocument.Part
  Dim hsf: set hsf = prt.HybridShapeFactory
  Dim sh, coords(2), pointCoord, pointCoordRef
  for each sh in container.HybridShapes
    if TypeName(sh) = "HybridShapePointExplicit" then
      sh.GetCoordinates coords
      set pointCoord = hsf.AddNewPointCoord(coords(0), coords(1), coords(2))
      set pointCoordRef = hsf.AddNewPointCoordWithReference(0, 0, 0, prt.CreateReferenceFromObject(sh))

      pointCoord.Name = sh.Name + "_coords"
      pointCoordRef.Name = sh.Name + "_coords_ref"

      ' append to container
      if TypeName(container) = "Body" then
        container.InsertHybridShape pointCoord
        container.InsertHybridShape pointCoordRef 
      else
        container.AppendHybridShape pointCoord
        container.AppendHybridShape pointCoordRef 
      end if
    end if
  next
End Sub 

RE: Spline thru isolated points

Hi I am having an error in third line

if "Normal" <> sel.SelectElement(Array("HybridBody", "Body"), "Select geometrical set or body containing isolated points", True) then

RE: Spline thru isolated points

Ooops, it should be SelectElement2

RE: Spline thru isolated points

yes but still nothing happen when i select geo set.
please help
here is the code
Sub CATMain()
Dim sel: set sel = CATIA.ActiveDocument.Selection
if "Normal" <> sel.SelectElement2(Array("HybridBody", "Body"), "Select geometrical set or body containing isolated points", True) then
exit sub
end if

Dim container: set container = sel.Item(1).Value
Dim prt: set prt = CATIA.ActiveDocument.Part
Dim hsf: set hsf = prt.HybridShapeFactory
Dim sh, coords(2), pointCoord, pointCoordRef
for each sh in container.HybridShapes
if TypeName(sh) = "HybridShapePointExplicit" then
sh.GetCoordinates coords
set pointCoord = hsf.AddNewPointCoord(coords(0), coords(1), coords(2))
set pointCoordRef = hsf.AddNewPointCoordWithReference(0, 0, 0, prt.CreateReferenceFromObject(sh))

pointCoord.Name = sh.Name + "_coords"
pointCoordRef.Name = sh.Name + "_coords_ref"

' append to container
if TypeName(container) = "Body" then
container.InsertHybridShape pointCoord
container.InsertHybridShape pointCoordRef
else
container.AppendHybridShape pointCoord
container.AppendHybridShape pointCoordRef
end if
end if
next
End Sub

RE: Spline thru isolated points

Does selected geoset has explicit points inside?
Does it has nested geosets? Can you provide a sample part?

RE: Spline thru isolated points

in the code, typename is specified to "HybridShapePointExplicit"
whereas your points are of type "HybridShapePointTangent"
so the if-loop is not executed

regards,
LWolf

RE: Spline thru isolated points

fastest way to make it work is to change the line

If TypeName(sh) = "HybridShapePointExplicit" Then
to
If TypeName(sh) = "HybridShapePointExplicit" Or TypeName(sh) = "HybridShapePointTangent" Then

regards,
LWolf

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! Already a Member? Login


Resources

eBook - Functional Prototyping Using Metal 3D Printing
Functional prototypes are a key step in product development – they give engineers a chance to test new ideas and designs while also revealing how the product will stand up to real-world use. And when it comes to functional prototypes, 3D printing is rewriting the rules of what’s possible. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close