From: tszeis on
I'd like to use custom created Coordinate Systems as a means to
position things in a Solidworks assembly using API.

Does anyone have experience doing this type of thing?

From: Frank Möbus on
> I'd like to use custom created Coordinate Systems as a means to
> position things in a Solidworks assembly using API.

What do you want to position in your assembly? Parts or something else.
I have only little experience with position parts in assemblies, using
their Component2 Objects, which represent the parts within assembly
documents. These Component2 Objects hold the geometrical transformation
information and provide methods to manipulate it.
If this meets your needs I can describe it a little more in detail.
If not, please describe your problem in detail.

greetz
From: tszeis on

Frank Möbus wrote:
> > I'd like to use custom created Coordinate Systems as a means to
> > position things in a Solidworks assembly using API.
>
> What do you want to position in your assembly? Parts or something else.
> I have only little experience with position parts in assemblies, using
> their Component2 Objects, which represent the parts within assembly
> documents. These Component2 Objects hold the geometrical transformation
> information and provide methods to manipulate it.
> If this meets your needs I can describe it a little more in detail.
> If not, please describe your problem in detail.
>
> greetz

I'm not sure if the Component2 matches my needs or not. It sounds
like it might. What I want to do is position parts in an assembly bases
on positional references. I thought about using named faces and
automating but it seems too complex and its overkill, since the parts
I'm assembling could be set in a fixed location and still serve the
purpose.

From: Frank Möbus on
> I'm not sure if the Component2 matches my needs or not. It sounds
> like it might. What I want to do is position parts in an assembly bases
> on positional references. I thought about using named faces and
> automating but it seems too complex and its overkill, since the parts
> I'm assembling could be set in a fixed location and still serve the
> purpose.
>

Let's start with the basics. How to put parts in assemblies. Therefore
you've got your AssemblyDoc object which represents your assembly document.
First you have to add a part using AssemblyDoc::AddComponent4. This
method(function) needs the partfilename and the position (x,y,z coords)
where you want to put this part in the assembly. This method returns a
Component2 object which represents this part. Now you can put a further
part to the assembly document by using the same function. You will get
another Component2 object for this part.

If you want to reposition the parts in the assembly you can obtain an
transformation object from the Component2 objects using
Component2::Transform2. This function returns a MathTransform object
which handles the geometrical transformation of the Component2 (part in
the assembly). Now you can repostion you part in terms of 4x4
transformation matrix (you should be familiar with this)



Now I will guess a little, what you meant with:

> What I want to do is position parts in an assembly bases
> on positional references. I thought about using named faces and
> automating [..]

You want to align 2 parts (part1 and part2) e.g. so that a face of part1
is next to an face of part2 (e.g. distance zero and parallel) by using
named faces. Therefore you will need to deal with AssemblyMates. Named
faces are a good idea, due to selecting these faces. This you will need
to mate them in the assembly.

any questions? just ask :o)

 | 
Pages: 1
Prev: Run Time Errors
Next: the 3GB Switch?