Set PHpob = pcbDoc.PlacementObstructs(epcbSelectAll,0) returns a collection of placement obstructs so you should use a for each loop to get the actual placement obstructs.
If (ValidateServer(pcbDoc) = 1) Then
Dim PHfso, PHf1, PHdesignName, PHtoppo, PHbotpo, PHpob, PHside, PHlayct
PHlayct = pcbDoc.LayerCount
Set PHpobColl = pcbDoc.PlacementObstructs(epcbSelectAll,0)
'msgbox ("layer count is: " & PHlayct) 'just to make sure it works and it does
for each PoObj in PHpobColl
PHside = PoObj.Layer
If Phlayct = PoObj.Layer Then
ElseIf PoObj.Layer = 1 Then
PHtoppo = PoObj.Height
The error is because you used the Set statement with a variable (not an object) assignment.
The Layer property is a number, so the Set statement is not required.
Set PHside = PHpob.Layer
PHside = PHpob.Layer
and your script should work.
I added the For Each code to go through all of the placement obstructs. After looping through and getting a 1 then another 1, then another, then 14, another 14, something else was going on. I added a count to the collection to find out how many placementobstructs are on the document, I got 34. 12 on layer 1 and 22 on layer 14.
So I had to modify your code to find only the obsctruct that had a height greater than 0. So I added an AND.
This is what I did.
If Phlayct = PHpob.Layer And PHpob.Height > 0 Then
PHbotpo = PHpob.Height
msgbox PHbotpo 'just to see if it works
ElseIf PHpob.Layer = 1 And PHpob.Height > 0 Then
PHtoppo = PHpob.Height
msgbox PHtoppo 'just to see if it works
I am not sure what I will do if I have more than 1 obstruct on layer 1 with a height of 0. My guess is that it will just spit out the first obstruct with a height greater than 0.