ilogic add constraints snip

ilogic add constraints snip

blandb
Mentor Mentor
968 Views
5 Replies
Message 1 of 6

ilogic add constraints snip

blandb
Mentor
Mentor
Constraints.AddFlush("Flush1", "POST", "XZ Plane", "ORIGIN", "XZ Plane",
                     offset := 0.0, biasPoint1 := Nothing, biasPoint2 := Nothing)

How do I utilize this command to access the assembly origin plane? It only allows for other components. Any ideas? Is there a better way? 

Autodesk Certified Professional
0 Likes
969 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Need much more context here. Either some Pics, Video or a more in depth description of what your trying to accomplish..  By "Assembly Origin Plane" do you mean a sub assembly you are placing or the Main Assembly you are placing a part in? and "Is there a better way" is a dangerous thing to ask around these parts lol.... but to answer that, you'll need to give more information on what you're doing, why you want to and how the parts are created...

0 Likes
Message 3 of 6

blandb
Mentor
Mentor

Nothing in particular, If you just have an assembly open with a part floating in it. and I want to add a constraint of the parts XY plane flush with the origin XY plane, I cannot seem to do it. For example, if I did a component replace on something and the constraints don't map over, then I can choose to delete the constraints, but then also Add constraints for the new component.  I know how to make the relation to another parts using the snippet above, but what if I didnt want to constrain to another part, but just use the origin planes and offset some value.

Autodesk Certified Professional
0 Likes
Message 4 of 6

Anonymous
Not applicable

Short answer to access the Main Assembly's Origin Plan is

  1. replace "ORIGIN" with "" (empty) 
  2. your component must have the occurrence descriptor ie: "POST:1" in leu of "POST"

However, doing as you're saying would require a lot more coding where you can run the rule that would wait for you to select the item then a menu to select planes to mate and offset. its definitely do-able but would take a lot more than a snippet... however... to access the assembly you're in, its empty parenthesis "". and that's if the rule is in the document and not external.

 

0 Likes
Message 5 of 6

blandb
Mentor
Mentor

I stagnated the browser name. That is why there isn't an occurrence name. This will be watching an end post in a sub-assembly. I am trying to avoid making a LOD and having both version of the post in there, then using the "is active" functions to remove/show what I need.

 

The form I have will give an option to change this particular end post from a single post to a welded post with a base plate (sub-assembly). I never thought about just blanking the other component name. I will try later and see if this works. I'm familiar with ilogic, just trying to utilize some of the newer functions to see if I know how they work. Seeing if I can get away with not using the "is active" functions and needing both versions of the post in the sub-assembly. Trying to automatically remove one post, add the new post, and constrain into position.

 

Thanks 

Autodesk Certified Professional
0 Likes
Message 6 of 6

dutt.thakar
Collaborator
Collaborator

Whenever you want to constrain anything with Assembly origin planes, keep it blank and it will work as mentioned by @Anonymous , but looking at your last reply, if you are planning to change single and welded posts, you will have to use "Components.Add("OccurrenceName","Filename.ipt/iam")" Snippet. You can use ThisAssembly.Beginmanage and ThisAssembly.EndManage functions to swap them, and then constrain them, but there is a small issue using these, is that it actually uses the filename in strings, so if your part is standard and not copied again with different file name in another project, the above snippet will work, if you are changing the filenames of components that you want to swap using iLogic, I think it will be a problem because your filename in code needs to be updated according to the new name.

 

Just thought to let you know before you end up in other questions as you are planning to swap the components.

 

Thanks,

Regards,

Dutt Thakar.

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes