iLogic position of two or more part lists

iLogic position of two or more part lists

Anonymous
Not applicable
1,412 Views
12 Replies
Message 1 of 13

iLogic position of two or more part lists

Anonymous
Not applicable

Hello everyone,

Maybe who knows, it is possible to "glue" on curve  two or more part list together with use iLogic?

I need to do this, because I have many times this situation when I have two or more part lists with different informations.

 

Thanks a lot for any help

 

Picture before:

1.jpg

 

Picture after:

2.jpg

0 Likes
Accepted solutions (2)
1,413 Views
12 Replies
Replies (12)
Message 2 of 13

R.Mabery
Advocate
Advocate

I don't believe there is a way to "attach" the two together with code but you could certainly determine the location of each and move the one you want with code.

 

But again, they wouldn't act as one if you manually selected them.

 


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies
Message 3 of 13

Anonymous
Not applicable

As stated previously it is currently not possible to "glue" two lists together, however if you want to automatically create a parts list I have attached code that I use to do so.  It will need some editing in order to match the Column Numbers and Names, if you want multiple different parts lists you will need to filter (I filter by view representations) the lists.  If you have different columns I would recommend copying the code and creating a second rule specifically for that parts list (this will also require editing the code and setting up a way to filter for the parts list).

 

If you have questions feel free to ask and I will try to answer as quickly as I can.

 

Note- The code reads from first level iProperties, as such if they are not filled in you will have mostly blank columns.

Message 4 of 13

Anonymous
Not applicable

Thank you a lot for your reply and for information.

 

I also use so kind of filter and ther I don't have any problem about thet.

I just looking for some information how high the part list is  and then the rule automatically placed next part list on the previous one. Or something in that way if it is possible?

 

Thank you a lot for your time and help.

 

All the best,

 

Jernej

 
 
0 Likes
Message 5 of 13

Anonymous
Not applicable

Hello Randy Mabery,

 

Thank you a lot for your help and information.

 

I  looking for something like you say. Looking for some information how high the part list is  and then the rule automatically placed next part list on the previous one. Or something in that way if it is possible?

 

Thank you a lot for your time and help.

 

All the best,

 

Jernej

0 Likes
Message 6 of 13

R.Mabery
Advocate
Advocate

Take a look at the following properties for the PartsList object:

Position: You can use to find the origin of the PartsList

RangeBox: You can  the Max X & Y and Min X & Y and use to calculate the height and the width of the PartsList

 

 

 


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies
0 Likes
Message 7 of 13

WCrihfield
Mentor
Mentor
Accepted solution

Try this:

The code is a bit long to show the work of how I'm moving it.  But you could use this as a Sub routine.

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oPList1 As PartsList = oSheet.PartsLists.Item(1)
Dim oPList2 As PartsList = oSheet.PartsLists.Item(2)

'Assuming oPList1 is the first one and already in place
'and that oPList2 is the one you're wanting to move
'Also assumes you want the right sides of both to line up
'and that you want the top of the first and the bottomof the second to line up

'Get top right corner of oPList1
Dim oP1X As Double = oPList1.RangeBox.MaxPoint.X
Dim oP1Y As Double = oPList1.RangeBox.MaxPoint.Y
'Get bottom right corner of oPList2
Dim oP2X As Double = oPList2.RangeBox.MaxPoint.X
Dim oP2Y As Double = oPList2.RangeBox.MinPoint.Y

'Get differences between those two locations
Dim oXDiff As Double = oP1X - oP2X
Dim oYDiff As Double = oP1Y - oP2Y

Dim oP2Pos As Point2d = oPList2.Position

Dim oNewX As Double
If oXDiff < 0 Then 'oPList2 needs to move to the left
	oNewX = oP2Pos.X - Abs(oXDiff)
ElseIf oXDiff = 0 Then 'they are already aligned along the right side
	oNewX = oP2Pos.X
ElseIf oXDiff > 0 Then 'oPList2 needs to move to the right
	oNewX = oP2Pos.X + Abs(oXDiff)
End If

Dim oNewY As Double
If oYDiff < 0 Then 'oPList2 needs to move down
	oNewY = oP2Pos.Y - Abs(oYDiff)
ElseIf oYDiff = 0 Then 'they are already aligned top to bottom
	oNewY = oP2Pos.Y
ElseIf oYDiff > 0 Then 'oPList2 needs to move up
	oNewY = oP2Pos.Y + Abs(oYDiff)
End If
'Since I don't know where on the parts lists your origin positions will be...
Dim oNewPosition As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oNewX,oNewY)
oPList2.Position = oNewPosition


 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 8 of 13

Anonymous
Not applicable

Woow! Thank you very much for this code and very good solution for me.

 

This help me very well 🙂

 

All the best,

Jernej

0 Likes
Message 9 of 13

Anonymous
Not applicable

Hello Randy Mabery,

 

Maybe do you know if it is also possible to get the right number of Part list with click on it. 

In my case this number in square bracket.

oSheet.PartsLists.Item(?)

 Is not every time that is the part list number 2 on 1. 

 

Thank you a lot.

Best 

Jernej

0 Likes
Message 10 of 13

WCrihfield
Mentor
Mentor
Accepted solution

First of all, I'm not Randy Maybery. 🤔

And yes, it is very easy to allow you to select the two parts lists, but I was thinking you wanted to avoid as much manual interaction as possible with this automation project.

Here is the updated code, that allows you to select them.  It says right in the selection comments which is which.

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet

Dim oPList1 As PartsList = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingPartsListFilter, "Select the Parts List that will stay in place.")
Dim oPList2 As PartsList = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingPartsListFilter, "Select the Parts List that you want to move.")

'Also assumes you want the right sides of both to line up
'and that you want the top of the first and the bottomof the second to line up

'Get top right corner of oPList1
Dim oP1X As Double = oPList1.RangeBox.MaxPoint.X
Dim oP1Y As Double = oPList1.RangeBox.MaxPoint.Y
'Get bottom right corner of oPList2
Dim oP2X As Double = oPList2.RangeBox.MaxPoint.X
Dim oP2Y As Double = oPList2.RangeBox.MinPoint.Y

'Get differences between those two locations
Dim oXDiff As Double = oP1X - oP2X
Dim oYDiff As Double = oP1Y - oP2Y

Dim oP2Pos As Point2d = oPList2.Position

Dim oNewX As Double
If oXDiff < 0 Then 'oPList2 needs to move to the left
	oNewX = oP2Pos.X - Abs(oXDiff)
ElseIf oXDiff = 0 Then 'they are already aligned along the right side
	oNewX = oP2Pos.X
ElseIf oXDiff > 0 Then 'oPList2 needs to move to the right
	oNewX = oP2Pos.X + Abs(oXDiff)
End If

Dim oNewY As Double
If oYDiff < 0 Then 'oPList2 needs to move down
	oNewY = oP2Pos.Y - Abs(oYDiff)
ElseIf oYDiff = 0 Then 'they are already aligned top to bottom
	oNewY = oP2Pos.Y
ElseIf oYDiff > 0 Then 'oPList2 needs to move up
	oNewY = oP2Pos.Y + Abs(oYDiff)
End If
'Since I don't know where on the parts lists your origin positions will be...
Dim oNewPosition As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oNewX,oNewY)
oPList2.Position = oNewPosition

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 11 of 13

Anonymous
Not applicable

Wesley Crihfield I am so sorry for this my mistake... Really sorry...

 

And thank you a lot for this new freat version of iLogic. 🙂

 

All the best,

 

Jernej

0 Likes
Message 12 of 13

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Is problem resolved now?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 13 of 13

Anonymous
Not applicable

Dear CHANDRA SHEKAR,

 

Yes now is resolved.

 

Thank you very much.

 

Best regards,

Jernej

0 Likes