SAC-Target Within a Width

jmartt
Collaborator
Collaborator

SAC-Target Within a Width

jmartt
Collaborator
Collaborator

This is a new question, but extended from my previous one: https://forums.autodesk.com/t5/autocad-civil-3d-forum/sac-question/td-p/7807476

 

How can I tell the corridor to search for a target only out, say, 10 feet?

 

This isn't for targeting anything physical. It's for an .isvalid switch.

 

There needs to be better vernacular for this stuff. Or I need to learn it if it exists. I've spent a lot of time searching for "Target Offset" and getting not what will help me.

 

I've made a simple drawing and took a screenshot to illustrate. The assembly is default 1' high but, when it encounters the polyline on the magic layer, it changes to 10' high. You can see, it searches across the 100' gulf between the alignment. I need it to not do that.

 

I'll also attach a screenshot where @KMercier_C3D answered someone's question about this, but I believe that is an ootb SA(?) How do I add that functionality to my custom SA? 

 

Thanks!

 

 

Capture.PNGCapture2.PNG

0 Likes
Reply
Accepted solutions (2)
748 Views
8 Replies
Replies (8)

KMercier_C3D
Advisor
Advisor
Accepted solution
Add an auxiliary point AP1 from P1 at the origin that uses the offset target to override the delta X and adding AL1 between the points. Then use the equation if(myoffsettarget.isvalid, if(AL1.xlength<=10, myadjustedvaluewithvalidtarget,mydefaultvalue),mydefaultvalue)



Kati Mercier, P.E. | LinkedIn | AutoCAD Civil 3D Certified Professional
Pronouns: She/Her
Co-author of "Mastering AutoCAD Civil 3D 2013"
AU2019 Speaker::: CES321590: Analyze and Revise Existing Subassembly Composer PKT Files for AutoCAD Civil 3D
AU2017 Speaker::: CI125544: Analyze and Devise in Subassembly Composer
AU2012 Speaker::: CI3001: Reverse Engineering with Subassembly Composer for AutoCAD Civil 3D
AU2011 Speaker::: CI4252: Create Subassemblies That Think Outside the Box With Subassembly Composer for AutoCAD® Civil 3D®

Jowennl
Advisor
Advisor

Hi Jeff,

 

I absolutely agree with Kati's suggestion above. Just want to add this sample PKT that will guide you to the process (I took it from your other post). Please consider adding Variable Absolute and add Kati's suggestion above.

 

 

if(Increase.isvalid,If(AL1.XLength<=ATargetLimit,-ABig,-ANorm),-ANorm) <- You can see this in the attached PKT and all A means I converted them as absolute value.

 

Cheers,

Jowenn

jmartt
Collaborator
Collaborator

I got that to work. Thanks. But I didn't ask for enough, apparently. I need this to work when there's an Increase or an IncreaseMore. (The two never meet, so it is really an "or".)

 

I've been banging slightly different versions of this in and can't get that red "!" to go away. Why won't this work?

 

if (Increase.isvalid, if(AL1.xlength<10, Big, if (IncreaseMore.isvalid, if(AL1.xlength<10, Bigger, Norm), Norm), Norm))

 

In English: "If you find the polyline on the magic "Increase" layer and its within 10' of the centerline, use the "Big" value for this Delta Y. Or if you find a polyline on the magic IncreaseMore layer and its within 10' of centerline, use the "Bigger" value for this Delta Y. If you don't find either of them suckers, just use the "Norm" value. 

 

...And I can do this with just one AL1, right? Or do I need another one to target the IncreaseMore? Maybe I do. But I don't think that's the problem with the if-then code.

 

 

 

Capture.PNG

0 Likes

KMercier_C3D
Advisor
Advisor
I'm nowhere accessible to SAC right now to confirm but I think you need one
more ,norm in between the last two )) in order to provide all four false
answers to get rid of the error.


Kati Mercier, P.E. | LinkedIn | AutoCAD Civil 3D Certified Professional
Pronouns: She/Her
Co-author of "Mastering AutoCAD Civil 3D 2013"
AU2019 Speaker::: CES321590: Analyze and Revise Existing Subassembly Composer PKT Files for AutoCAD Civil 3D
AU2017 Speaker::: CI125544: Analyze and Devise in Subassembly Composer
AU2012 Speaker::: CI3001: Reverse Engineering with Subassembly Composer for AutoCAD Civil 3D
AU2011 Speaker::: CI4252: Create Subassemblies That Think Outside the Box With Subassembly Composer for AutoCAD® Civil 3D®

jmartt
Collaborator
Collaborator

I appreciate you taking a stab, @KMercier_C3D. That didn't work.

BTW, the attachment pkt to my last post had TargetParameter2 instead of IncreaseMore. It keeps forgetting its name. But I've changed it and that's not the problem, it would seem.

 

Oh! But hovering over that red "!" tells you stuff! How nice. It says that my "if" operator requires either two or three operands. Wonder where a guy can get operands this time o' night?

0 Likes

Jowennl
Advisor
Advisor

Hi Jeff,

 

Please see attached PKT. I think what you intend to do is have 2 possible target and horizontal limit as well. I would normally choose 1 target and use offset alignment with value to control them but this would also work but you will need to possible target instead of one.

 

See before if they are parallel, the bigger will also be a target in both side. So adding target limit is needed.

 

This is before - both target co exist when parallelThis is before - both target co exist when parallelThis is after - Even if it is parallel it check the max limit distanceThis is after - Even if it is parallel it check the max limit distanceNested Coding to make both working and checking both target maxNested Coding to make both working and checking both target max

Idea now, you can have 1 target exist then it will check if it is within distance range. Then if both exist bigger over rule but will check distance of bigger as well.

 

Codes is so long now.. It looks like this 🙂

 

if(IncreaseMore.isvalid,if(AL2.XLength<=AIncMoreMaxLimit,-ABigger,if(Increase.isvalid,if(AL1.XLength<=AIncMaxLimit,-ABig,-ANorm),-ANorm)),if(Increase.isvalid,if(AL1.XLength<=AIncMaxLimit,-ABig,-ANorm),-ANorm))

 

Cheers,

Jowenn

KMercier_C3D
Advisor
Advisor
Accepted solution

Here is another possible solution. AP1&AL1 are on Increase. AP2&AL2 are on IncreaseMore.

 

The test equation looks like this: if ((Increase.isvalid)AND(AL1.xlength<=10), Big, if((IncreaseMore.isvalid)AND(AL2.xlength<=10), Bigger, Norm))



Kati Mercier, P.E. | LinkedIn | AutoCAD Civil 3D Certified Professional
Pronouns: She/Her
Co-author of "Mastering AutoCAD Civil 3D 2013"
AU2019 Speaker::: CES321590: Analyze and Revise Existing Subassembly Composer PKT Files for AutoCAD Civil 3D
AU2017 Speaker::: CI125544: Analyze and Devise in Subassembly Composer
AU2012 Speaker::: CI3001: Reverse Engineering with Subassembly Composer for AutoCAD Civil 3D
AU2011 Speaker::: CI4252: Create Subassemblies That Think Outside the Box With Subassembly Composer for AutoCAD® Civil 3D®

jmartt
Collaborator
Collaborator

Again, you've made my day, @KMercier_C3D!

 

Here's some notes:

 

I initially tested both Jowenn's and Kati's SAs. For each of the SAs I did the following:

 

  • Erased the existing corridor and all SAs from the drawing using standard CAD erase.
  • Imported the (brilliantly crafted and generously supplied) SA and added to the existing assembly.
  • Created a new corridor and selected by layer the polylines on the magic layers for Increase and IncreaseMore.
  • Told the sample line group to sample the new corridor.
  • Moved the sample lines to check the different conditions (no line within 10', Increase within 10', IncreaseMore within 10')

 

Neither worked.

 

"What are the chances they both got it wrong?" I asked myself. Pretty slim. So, on a hunch I changed the name of the SAs under Packet Settings from "Test11" to "Jowenn" and "Kati".

 

Jowenn's - When I tested this as "Test11" the corridor would change from Norm to Big, but it would change by the same amount (Big) whether the Increase or IncreaseMore was present, and no matter how far away. This is the same behavior as the original Test11 that was present in the drawing. After renaming it "Jowenn", it was obviously acting differently than when it was named "Test11", but it would not change in any situation from Norm. I chalk this up to (maybe) needing to specify somehow what the maxdistance is? I'm not sure. But I'd bet the problem with this is more on my end than Jowenn's.

 

Kati's - When I tested as "Test11" it acted just as Jowenn's when named "Test11". But when I renamed it to "Kati" it acted as desired (to much rejoicing).

 

So, I'm led to conclude, and it's fairly obvious to me now that I've written this out, that the "Test11" which I originally had in the dwg was not actually erased and then replaced by the SAs imported with the same name. (Even after purging all in the drawing, if I brought a "Test11" back in, it still exhibited the same behavior.) This probably is a known thing and I happened to stumble upon it. Glad I did relatively early. Please enlighten me if I've got this wrong, but I tested several times.

 

Jowenn's post warrants further consideration. I can see how the interface may be cleaner (and may lead to 0001 functionality in the transitions if and when I ever get to the point where I fully understand his video) if I target one polyline and use the offset distance of that polyline to switch the input parameter variables. But I can't wrap my head around the if-then statement(s) that would allow that to happen. I will hopefully revisit this idea. But for today I've got a lot of if-then statements to copy-and-paste and a lot of subassemblies to rename.

 

Thanks again.

 

 

0 Likes